Here is the script where I merge the Figure and Supplementary Figure together before we submit the paper. I would like to know the difference between gs and pdftk?

gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=Figure.gs.pdf Figure*.pdf
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=Supp.Figure.gs.pdf Supp*Fig*.pdf

pdftk Figure*.pdf cat output Figure.tk.pdf
pdftk Supp*Fig*.pdf cat output Supp.Figure.tk.pdf

Which one is better? From my own pdf merge process, I found:

  1. The size of the pdf file is much smaller than pdftk
  2. gs sometime will revolve 90 degree when merge pdf files

In my experience, I prefer pdftk.

Distributor ID: Ubuntu
Description:    Ubuntu 14.04.2 LTS
Release:        14.04
Codename:       trusty

I guess It's hard to tell what is better because it depends on your inputs and expectations. I don't know the details of gs but I wouldn't use pdftk and this is why:

I can tell from the sources that pdftk uses iText 1.x as its PDF engine. iText is an OSS java library and the version used in pdftk (according to the producer in the info dictionary of the generated docs) is circa 10 years old, beyond stable or mature.. it's ancient. In the past 10 years a lot of fixes have been applied to iText which is now at version 7 (and those fixes are not in pdftk) and the PDF spec has moved and is slowly moving leaving iText 1.x behind. So, unless they upgrade to some newer version of iText, you can expect most of the files to work but also bugs and errors with a tendency to grow over time.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.