pdfbatch-processingpdf-manipulationsejda

Sejda merging PDFs from CSV filelist names


I recently installed sedja-console for merging pdf files from command line.

The names of the input pdf files are in a CSV file named filelist-inputs.csv like this:

./Temp/source/046032.pdf,./Temp/source/048155.pdf
./Temp/source/049278.pdf,./Temp/source/050818.pdf,./Temp/source/052962.pdf
./Temp/source/052962.pdf,./Temp/source/054117.pdf

I need one output pdf file for the first line of the CSV filelist names, other output pdf file for the second line of the second line, other output for the third line, and so...

I tried a command line like this:

~$ sejda-console merge -l filelist-inputs.csv -o ./Temp/target/merged[FILENUMBER####].pdf

But it only creates a unique file named literally merged[FILENUMBER####].pdf, when I want 3 files:

merged0001.pdf
merged0002.pdf
merged0003.pdf

I've simplified the problem, because I need to merge more than 3500 pdf files in 700 output files.


Solution

  • Sejda takes all the values in the CSV and generates a single merged PDF, there isn't any option or setting in Sejda to achieve what you asked, you will need some scripting to loop through the CSV lines, create a CSV per line and feed it to Sejda.

    The output file name merged[FILENUMBER####].pdf is literally used because the PDF merge task generates one output file and it expects an explicit output file name. Prefixes like [CURRENTPAGE] or [FILENUMBER] are valid when used as -p argument in tasks generating multiple output PDF files (split tasks etc).