Results 1 to 13 of 13

Thread: How to split a PDF into pages using VBA

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,954
    Location
    I did not test this. The concept would be similar. There is a newer version of pdfsam at http://pdfsam.org.

    See the help in the pdfsam installed pdf help file for command line parameters.
    pdfsam="java -jar c:\myfiles\pdfsam0.7\lib\pdfsam-console-0.7.0.jar"
    pdfFiles="-f e:\masoud\1a.pdf -f e:\masoud\2.pdf -f e:\masoud\3.pdf -f e:\masoud\4.pdf -f e:\masoud\1b.pdf"
    pdfOut="-o e:\masoud\1.pdf"
    pdfsamStr=pdfsam & " " & pdfFiles & " " & pdfOut & " -overwrite concat"
    Shell pdfsamStr, vbNormalFocus
    The main thing to do is to try it from the Run dialog, WIN+R, and once you get the string right, you can build it in vba. You may need to add quotes around file paths as part of the string to pass to Shell().

    You may also need "cmd /c " as the first part of variable pdfsam to get Shell() to use it properly.

    I used version 0.7 in this example. The latest stable version is 1.0.3 so use it and modify the pdfsam variable to use your path and your name for the latest version as applicable.
    Last edited by Aussiebear; 02-26-2025 at 03:31 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •