4

I know this question has been answered in other threads, but none of the solutions worked for me. I have a pdf file which contains 4 plots with millions of colourful dots (Manhattan plots). The pdf file is so big (~100 MB) and I cannot t even open it properly on my computer. I have tried gs and commands like

gs -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -q -o output.pdf manhattan_plots_long.pdf

but seems that it does not work and I get an error message which says "Unable to convert color space to sRGB, reverting strategy to LeaveColorUnchanged."

I could find another code which fixes this error, but the new pdf file has the same size!

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dNOPAUSE -dQUIET -dBATCH \
  -dAutoRotatePages=/None -dUseCIEColor -sOutputFile=output.pdf input.pdf

I do not understand what is wrong, is there any solution for my problem? thanks

  • Have you tried -dPDFSETTINGS=/screen? – DopeGhoti Oct 26 '17 at 19:52
  • @ DopeGhoti,yes. When I try with -dPDFSETTINGS=/screen I get the error message that I mentioned above. – Anna1364 Oct 26 '17 at 20:05
  • Have you tried using the imagemagick convert tool? – Academiphile Oct 26 '17 at 22:42
  • Guess: the embedded images are too large, and most programs run into trouble handling them. Ideas: (1) Use pdftk or some other tool to extract single pages, and see if they render, so you can narrow down the problem. (2) Find another pdf with a simple image, make copy of your PDF, open copy in text editor that can handle large files (e.g. emacs), find the images and replace them with the simple image. Then fix xref table with pdftk. You'll probably need some understanding of the PDF format to fix the problem, anyway, and this way you can get some idea how it looks like. – dirkt Oct 27 '17 at 8:20
3

Try adding -r150 to the second command, so

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dNOPAUSE -dQUIET -dBATCH \ -dAutoRotatePages=/None -dUseCIEColor -r150 -sOutputFile=output.pdf input.pdf

You can play with numbers smaller than 150 to reduce image DPI.

Another option that can help is -dCompressFonts=true

| improve this answer | |
0

As I did not see the file, I can only guess that you have a highly detailed document intended for high-quality prints (e.g. large posters). The graphics are most likely vector graphics which ghostscript wants to conserve. Follow @Academiphile advice to have the document's individual pages rendered off-screen into adequately low resolution raster images:

ghostscript -dNOPAUSE -dBATCH -sDEVICE=tiffgray -sOutputFile=output.tif input.pdf

The resulting multi-page tif will be large, but you can proceed to view the images with a viewer of your choice. Please do not try to do anything else with that file (e.g. edit and give to print – the printer operator would be furious and/or suffer a mental breakdown).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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