Showing posts with label PDF. Show all posts
Showing posts with label PDF. Show all posts

Wednesday, February 8, 2023

Merge PDF files in a directory to one PDF file

This script merge files with spaces in the name and sorts them by name.

Enter in a directory with PDFs and execute:

 

ls -v *.pdf | bash -c 'IFS=$'"'"'\n'"'"' read -d "" -ra x;pdfunite "${x[@]}" output.pdf'
 

Source: Stackoverflow

Sunday, February 5, 2023

Joining any files in PostScript or PDF

gs -q -dNOPAUSE -dBATCH -sDEVICE=pswrite -sOutputFile=bla.ps -f foo1.ps foo2.ps

gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=bla.pdf -f foo1.pdf foo2.pdf

or

pdfunite foo1.pdf foo2.pdf result.pdf
 

or

all files (pdf) in directory:

 
ls -v *.pdf | bash -c 'IFS=$'"'"'\n'"'"' read -d "" -ra x;pdfunite "${x[@]}" output.pdf'