Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to batch open multiple PDF files and batch export them again as PDF files
#5
To (sort of) answer my own question, here is what I decided to do:
Note #1: the following will work for single pages, some extra bash scripting is needed for multiple pages
Note #2: choose the <DPI> of your liking

[1] In case the file is EPS, first convert to PDF

Code:
$ epstopdf input_file.eps input_file.pdf

[2] Get the PDF metadata

Code:
$ pdftk input_file.pdf dump_data_utf8 output input_file.data

[3] Convert the the PDF file to PPM

Code:
$ pdftoppm -cropbox -r <DPI> input_file.pdf > input_file.ppm

[4] Convert the PPM to PDF

Code:
$ gimp -idfn --batch-interpreter python-fu-eval -b "image = pdb.gimp_file_load('input_file.ppm', 'input_file.ppm'); pdb.gimp_image_set_resolution(image, <DPI>, <DPI>); drawable = pdb.gimp_image_get_active_drawable(image); pdb.file_pdf_save(image, drawable, 'output_file.pdf', 'output_file.pdf', True, True, True); pdb.gimp_quit(1)"

[5] Set the PDF metadata

Code:
$ pdftk input_file.pdf update_info_utf8 input_file.data output output_file.pdf

Any feedback would be welcome :-)
Reply


Messages In This Thread
RE: How to batch open multiple PDF files and batch export them again as PDF files - by kasioumis - 02-20-2019, 08:40 PM

Forum Jump: