1

This is what I am trying to achieve:

I got several hundred small PDF files of varying size. I need to merge them into chunks of close to but no more than a certain target file size.

I am familiar with gs as well as pdftk (though i prefer to use gs).

Does anyone know a way of predicting the filesize of the merged output PDF beforehand so that i can use it to select the files to be included in the next chunk?

I am not aware of something like a --dry-run option for gs...

(If there is no other way i guess i would have to make a guess based on the sum of the input file sizes and go for trial and error.)

Thank you in advance!

jschpmr
  • 98
  • 5
  • 1
    There's no way of predicting the output size. Provided you are using a reasonably current version of Ghostscript (to avoid decompression/recompesesion of JPEG) then unless you are taking some action to reduce the size of the content I'd expect the output file size to be not wildly different from the sum of the sizes of the input files though. There are a few things the PDF interpreter doesn't pass to the pdfwrite device (marked content for starters) and dropping that could conceivably make a noticeable difference. – KenS Nov 18 '21 at 13:42
  • Went with that and worked out fine - outpufile size was generally a bit less than the sum of the input files, but at a consistent ratio. Thanks for commenting ;) – jschpmr Nov 19 '21 at 14:58

0 Answers0