• How to split a PDF into parts using visual basic 2013

    ShikhaTan Member

    How to split a PDF into parts using visual basic 2013

  • Ganesh Member

    The easiest way, imo, would be to call the PDFtk Server from your VB code. The PDF Toolkit (PDFtk) is an excellent (free!) product that has numerous features to manipulate PDFs. It comes in both command line and GUI versions. The command line version is called PDFtk Server and may be downloaded here:

    http://www.pdflabs.com/tools/pdftk-server/

    Don’t be misled by “Server” in the name. I don’t know why they called it that, but it’s just an executable (pdftk.exe, with a supporting DLL, libiconv2.dll) that runs on XP, Vista, W7, and W8 (I tested it on W10 Pro 64-bit and it worked fine, but I don’t think it is officially certified yet for W10). That is, it does not have to run on a “server” OS.

    The operation to split a PDF into separate pages is called burst. You may learn about it here:
    https://www.pdflabs.com/docs/pdftk-man-page/#dest-op-burst

    > our App needs separate pages

    So here’s the one-line command to split your large PDF into separate pages:

    pdftk in.pdf burst

    By default, the separate pages will be named pg_xxxx.pdf (where xxxx is the page number, such as pg_0001, pg_0002, etc.). If you prefer to create different file names, use the output option, such as:

    pdftk in.pdf burst output separate%02d.pdf

    That will create files called separate01.pdf, separate02.pdf, etc.

    The burst operation also creates a file called doc_data.txt that contains a lot of metadata from the source file. The content of the file is described in the dump_data operation:

    https://www.pdflabs.com/docs/pdftk-man-page/#dest-op-dump-data

Viewing 1 reply thread
  • You must be logged in to reply to this topic.
en_USEnglish