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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Remove a page from pdf document in C#

Remove a page from pdf document in C#

Scheduled Pinned Locked Moved C#
csharpgraphicsquestion
4 Posts 2 Posters 14 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.
  • M Offline
    M Offline
    Member 14474607
    wrote on last edited by
    #1

    Hello, Can we remove a page from a pdf document using C#? I started to look at the

    PrintDocument

    object part of the

    System.Drawing.Printing;

    namespace. In a bit of crunch time, please let me know if this is possible before we take this option of the table. thanks a bunch!

    OriginalGriffO 1 Reply Last reply
    0
    • M Member 14474607

      Hello, Can we remove a page from a pdf document using C#? I started to look at the

      PrintDocument

      object part of the

      System.Drawing.Printing;

      namespace. In a bit of crunch time, please let me know if this is possible before we take this option of the table. thanks a bunch!

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      PrintDocument doesn't do anything with or to PDF files - it has no idea they even exist! All it is concerned with is letting you format and convert your data to a format that the selected printer understands - no more than that. If you actually want to remove a page from a PDF file, you will have to access and modify the file itself, which you do by reading the PDF file, and only importing the pages you want - then exporting the data to a (preferably new) file. You can do that with iTextSharp, I believe, but I've not tried it myself: c# - itextsharp trimming pdf document's pages - Stack Overflow[^]

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      M 1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

        PrintDocument doesn't do anything with or to PDF files - it has no idea they even exist! All it is concerned with is letting you format and convert your data to a format that the selected printer understands - no more than that. If you actually want to remove a page from a PDF file, you will have to access and modify the file itself, which you do by reading the PDF file, and only importing the pages you want - then exporting the data to a (preferably new) file. You can do that with iTextSharp, I believe, but I've not tried it myself: c# - itextsharp trimming pdf document's pages - Stack Overflow[^]

        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

        M Offline
        M Offline
        Member 14474607
        wrote on last edited by
        #3

        Thank you so much for clarifying. Really appreciate the timely response!

        OriginalGriffO 1 Reply Last reply
        0
        • M Member 14474607

          Thank you so much for clarifying. Really appreciate the timely response!

          OriginalGriffO Offline
          OriginalGriffO Offline
          OriginalGriff
          wrote on last edited by
          #4

          You're welcome!

          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
          "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

          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