Linux - Software This 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. |
Notices |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
08-27-2004, 07:16 AM
|
#1
|
Senior Member
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126
Rep:
|
Ghostscript: why is pdf size sometimes increased so much?
I had two pdf files each of size 100k, containing scanned images.
Those pdfs were probably created by Adobe Acrobat.
I merged them with ghostscript, as follows:
gs -dNOPAUSE -sDEVICE=pswrite -sOutputFile=1.ps -dBATCH 1.pdf
gs -dNOPAUSE -sDEVICE=pswrite -sOutputFile=2.ps -dBATCH 2.pdf
gs -dNOPAUSE -sDEVICE=pswrite -sOutputFile=merged.ps -dBATCH 1.ps 2.ps
gs -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=merged.pdf -sProcessColorModel=DeviceGray -sBitsPerSample=1 -dCompressPages=true -dBATCH merged.ps
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?
Last edited by J_Szucs; 08-27-2004 at 07:26 AM.
|
|
|
08-27-2004, 08:56 AM
|
#2
|
Senior Member
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,994
Rep:
|
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.
Hope that's of some help,
— Robert J. Lee
|
|
|
08-27-2004, 10:19 AM
|
#3
|
Senior Member
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126
Original Poster
Rep:
|
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)
|
|
|
All times are GMT -5. The time now is 09:44 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|