Ghostscript: why is pdf size sometimes increased so much?
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
The problem is that the resulting file (merged.pdf) is about 15 times as big as it should be (3M instead of 200k), and, maybe because of this, it is very-very slowly rendered on the screen by acroread.
The result is about the same either with or without the ProcessColorModel, BitsPerSample and CompressPages options, which I tried to use to reduce file size.
Strangely, I found that the -r option of gs can only grow file size (-r60 resulted in a cca. 1.5 times larger file).
I wonder what is wrong with those pdf files (or with ghostscript), that they become so large when extracted to ps and re-encoded to pdf?
PostScript is an interpreted language, where everything on the page is divided into a number of different drawing instructions that get processed to build up the page. I believe that PDF is similar (but I may be wrong).
I suspect that what's happening is that the conversion to PS takes each PDF instruction and converts it into a number of different postscript instructions, and the conversion back to PDF takes each PS instruction and converts it into several PDF instructions.
You might try writing the output file to postscript and using the ps2pdf utility to convert it, which has a number of options to control how the processing works, and what optimisations are done etc.
I think that ps2pdf actually calls gs to do the conversion in a way that any option to ps2pdf that affects the resulting pdf file is simply passed to gs.
So, those options are actually the options of gs, which I carefully checked.
I suspect that my problem may rather be related to the fact that the pdfs to be merged are of pdf version 1.4, which pdf version my gs 7.04 can only read, but cannot write, so, maybe it writes in pdf version 1.3, which cannot compress the contents so efficiently. (just realised that I have no such problem with pdf files up to version 1.3)