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.
First,
- Set up a working directory structure as outlined below.
- Move directories of source files to be merged into the 'input' subdir.
If you want to merge a single set of files:
- Double click on the DOSPDFtkMerge_s.bat file
- Provide inputs for the questions you will be prompted to answer.
If you want to batch any number of file sets:
- Use the directions below to 'Build a batch_processing.bat file'.
- Double click on your completed batch_processing.bat file.
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
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
This script assumes that the computer being used for implementation has PDFtk for Windows installed and that it is working at the commandline.
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.