I am trying to create a batch OR .bat file that will linearize MULTIPLE PDF files. I already have a script I commandeered that uses PDFTK that sends PDFs to the 'sendto' folder where they are combined. I would like to do the same with qpdf but use the --linearize
command instead.
The main problem is, I cannot combine the files first into one PDF using PDFTK and then linearize the one file - the files still turn out too big. What works the best is if I linearize each INDIVIDUAL file, and then combine them. It would probably be best if I could also combine them using qpdf, that way I wouldn't have to use two different programs.
IN SUMMATION:
This is the current bat file I have that works perfectly (below) -> I can select multiple PDF files, drop them into the bat file and out pops a new PDF file named Combined_PDFs.pdf. I want to do the SAME with qpdf, except linearize, THEN combine the files. I cannot get the syntax right, I simply do not know enough about bat files.
CURRENT WORKING SCRIPT:
@echo off
PUSHD "%~dp0"
setlocal enabledelayedexpansion
FOR %%A IN (%*) DO (set command=!command! %%A)
pdftk.exe %command% cat output "%~dp1Combined_PDFs.pdf" compress
This script works, but it will ONLY work for one file at a time:
@echo off
PUSHD "%~dp0"
setlocal enabledelayedexpansion
FOR %%A IN (%*) DO (set command=!command! %%A)
qpdf.exe --linearize %command% "%~dpn1_Reduced%~x1"
I need the script above to work for multiple inputs.