Skip to content

Instantly share code, notes, and snippets.

@frame
Last active October 19, 2018 09:40
Show Gist options
  • Save frame/280dcbade4eaeeb0a4b9fefff0eba836 to your computer and use it in GitHub Desktop.
Save frame/280dcbade4eaeeb0a4b9fefff0eba836 to your computer and use it in GitHub Desktop.
Merge input/*.pdf into a single pdf
REM Create folders ./gs/ and ./input/
REM Download Ghostscript (64bit) and extract to ./gs/
REM Copy PDF files to be merged to ./input/
REM Run merge-pdf.bat
@echo off
if exist input\input.txt del input\input.txt
for %%s in (input\*.pdf) do echo "%%s" >> input\input.txt
gs\bin\gswin64c.exe -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=output.pdf -dBATCH @input\input.txt
if exist input\input.txt del input\input.txt
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment