/DOSPDFtkMerge

This DOS batch script uses both ImageMagick for Windows and PDFtk for Windows from the DOS commandline to convert individual image files to PDFs and then merge these PDFs into one multipage PDF.

Primary LanguageBatchfileMIT LicenseMIT

DOSPDFtkMerge

What does this batch script do?

This DOS batch script uses both ImageMagick (https://www.imagemagick.org/) for Windows and PDFtk (https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/) for Windows from the DOS commandline to convert individual image files to PDFs and then merge these PDFs into one multipage PDF.

The original image files will remain in the directory after the script has finished processing.

This script only works with local Windows file paths.

How to use this batch script.

First,

  1. Set up a working directory structure as outlined below.
  2. Move directories of source files to be merged into the 'input' subdir.

If you want to merge a single set of files:

  1. Double click on the DOSPDFtkMerge_s.bat file
  2. Provide inputs for the questions you will be prompted to answer.

If you want to batch any number of file sets:

  1. Use the directions below to 'Build a batch_processing.bat file'.
  2. Double click on your completed batch_processing.bat file.

Directory structure.

basedir
  `-output subdir
      --log_m.txt
      --merged1.pdf
      --merged2.pdf
  `-input subdir
    `-subdir
        --sourcefile1
        --sourcefile2
        --sourcefile3
        --sourcefile4
    `-secondsubdir
        --sourcefile1
        --sourcefile2
        --sourcefile3
        --sourcefile4
        --sourcefile5
-DOSPDFtkMerge_m.bat
-DOSPDFtkMerge_s.bat
-batch_process.bat

Build a batch_processing.bat file.

Edit the batch_process.bat file between the following markers in the file.

rem edit START

*add lines here

rem edit STOP

An individual line to process a directory of source files should look like:

call DOSPDFtkMerge_m.bat merged_pdf_filename file_ext directory_to_process

Sample line with actual arguments added in:

call DOSPDFtkMerge_m.bat th7d68v83h8p3 tif 0010

It is recommended that this script be run on a set of copied images, not on "sole" copies.

This script assumes that the computer being used for implementation has PDFtk for Windows installed and that it is working at the commandline.

License

This software on this site is provided "as-is," without any express or implied warranty. In no event shall libmanuk be held liable for any damages arising from the use of the software.