Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Replace PDF Pages

Replace PDF Pages

Scheduled Pinned Locked Moved C#
helptutorialquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Killzone DeathMan
    wrote on last edited by
    #1

    Hello, I'm trying to do a program in C # to replace pages in a PDF file to another! I can get a page like this: PdfReader reader = new PdfReader (PdfFilePath); iTextSharp.text.pdf.PdfImportedPage page = pdfCpy.GetImportedPage (reader, pageNumber); pdfCpy.AddPage (page); How to replace such page by page 15 to page 15 of another PDF file? Someone can help me? Please! Sincerely, Killzone DeathMan

    L 1 Reply Last reply
    0
    • K Killzone DeathMan

      Hello, I'm trying to do a program in C # to replace pages in a PDF file to another! I can get a page like this: PdfReader reader = new PdfReader (PdfFilePath); iTextSharp.text.pdf.PdfImportedPage page = pdfCpy.GetImportedPage (reader, pageNumber); pdfCpy.AddPage (page); How to replace such page by page 15 to page 15 of another PDF file? Someone can help me? Please! Sincerely, Killzone DeathMan

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      This may be stating the ****ding obvious but:

      • Open pdf file1 and file2 for input.
      • Open pdf file3 for output.
      • Read pages 1 to 14 from file1 and write to file3.
      • Read page 15 from file2 and write to file3.
      • Read remaining pages from file1 and write to file3
      • Close all files.

      file3 now contains a copy of file1 with page 15 changed.

      Programming is work, it isn't finger painting. Luc Pattyn

      K 1 Reply Last reply
      0
      • L Lost User

        This may be stating the ****ding obvious but:

        • Open pdf file1 and file2 for input.
        • Open pdf file3 for output.
        • Read pages 1 to 14 from file1 and write to file3.
        • Read page 15 from file2 and write to file3.
        • Read remaining pages from file1 and write to file3
        • Close all files.

        file3 now contains a copy of file1 with page 15 changed.

        Programming is work, it isn't finger painting. Luc Pattyn

        K Offline
        K Offline
        Killzone DeathMan
        wrote on last edited by
        #3

        Thanks for the algorithm! I will try!

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups