I am using pstool & psfrag (with pdflatex) to replace text in eps files generated by Adobe Illustator. I noticed that the pdf files produced by pstool (using the \psfragfig command) are way smaller than those I can export directly from Adobe Illustrator (AI).

For example, an AI pdf file can be 1 MB, while the pstool-psfrag pdf file is 20 kB. My figures are usually simple black-white vector graphics (graphs, etc.) with no bitmap. For export, I use very minimal settings (e.g. no thumbnail embedding, no preserved illustrator editing capability, ...) compatible with X-1a:2001 (pdf version 1.3). Other versions are similar size.

I guess the pdf image file size must have a direct impact on the final document file size, so I'm considering exporting from AI to .eps and using something like \psfragfig{path_to_my_image}{} even when no text replacments are needed.

To my questions:

How come there is this dramatic reduction in file size - I guess there must be a lot of unnecessary data automatically generated by AI, rigt? How does pstool & psfrag process the file - does it look for essential files? Can it leave something important out? Is there a better way, how to clean the .pdf (.eps) files when I just want to include them into my document.

Note: My question comes mostly from interest (everything is working fine).

  • I also noticed that .pdf files produced with the latex -> dvips -> pstopdf are smaller than those obtained the pdflatex way. I guess this is because it incorporates only the glyphs used in the document, and not the whole font(s). – Bernard Apr 1 '18 at 21:51
  • pstool/psfrag essentially don't do anythng other than call ghostscript to convert the postscript resulting from dvips including the eps into a latex generated document to pdf, so you are just comparing ghostscript against adobe's ps to pdf conversion, not normally that much size difference – David Carlisle Apr 1 '18 at 21:52
  • @Bernard pdftex also subsets fonts usually – David Carlisle Apr 1 '18 at 21:52
  • @DavidCarlisle: If my guess is wrong then I have no explanation :o( – Bernard Apr 1 '18 at 21:56
  • This reminds me of the old days in which Mathematica by default attached all fonts to any poscript file generated. I am wondering if something similar is happening here, and your conversion chain gets rid of these fonts. After all psfrag does some font replacing. – marmot Apr 1 '18 at 22:04

As an experiment, I downloaded an AI vector file. Technology of the 90s: size 2.032KB. Then I opened it in AI and exported it in PDF and SVG formats: sizes of formats were reduced: PDF is 1,478KB and SVG 896KB.

The surprising thing is that when I open the SVG file in Inkscape and then export it in PDF format, it results in 363 Kb size (Why?). When I open the 2 PDF files there is no loss of quality since they are vectors. The Inkscape parameter for export indicates PDF version 1.5, option to embed fonts, and rasterization resolution 96 dpi.

Conclusion: I suggest to Use Inkscape for your vector graphics... and forget about the proprietary software paraphernalia.

enter image description here enter image description here

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.