I have a PDF file that I would like to optimize. I get the file from an external source, so I don’t have the means to recreate it from the very beginning.
When I open a file in Acrobat and request resources, it says that the fonts in the file occupy 90% + space. If I save the file as a postscript and then save the postscript file in an optimized PDF file, the file will be significantly smaller (80% smaller) and the fonts will still be embedded.
I am trying to recreate these results using ghostscript. I have tried various parameter permutations with pswrite and pdfwrite, but what happens when I do the initial conversion from PDF to Postscript, the text is converted to an image. When I convert back to PDF, the links to the fonts disappear, so I get a PDF file with the text "imaged" and not the actual fonts.
The file contains 22 Type1 built-in custom fonts that I have. I added fonts to the ghostscript search path and proved that ghostscript can find them with:
gs \ -I/home/nauc01 -sFONTPATH=/home/nauc01/fonts/Type1 \ -o 3783QP.pdf \ -sDEVICE=pdfwrite \ -g5950x8420 \ -c "200 700 moveto" \ -c "/3783QP findfont 60 scalefont setfont" \ -c "(TESTING !!!!!!) show showpage"
The resulting file has a correctly embedded font.
I also tried using ghostscript to go from PDF to PDF as follows:
gs \ -sDEVICE=pdfwrite \ -sNOPAUSE \ -I/home/nauc01 \ -dBATCH \ -dCompatibilityLevel=1.4 \ -dPDFSETTINGS=/printer \ -CompressFonts=true \ -dSubsetFonts=true \ -sOutputFile=output.pdf \ input.pdf
but the output is usually larger than the input, and I can’t view the file with anything other than ghostscript (adobe reader gives "the object label is poorly formatted").
I cannot provide the source file because it contains confidential information, but I will try to answer any questions that need to be answered regarding them.
Any ideas? Thanks in advance.