Reputation: 146
I'm having trouble to embed fonts in the outputted pdf from Ghostscript. My main approach is to split a pdf in half width, so I initially used the follow command:
gs -o left_sections.pdf -sDEVICE=pdfwrite -dAutoRotatePages=/None -g17700x6120 -c "[/CropBox [0 0 1770 6120] /PAGES pdfmark" -dFIXEDMEDIA -c "<</PageOffset [0 0]>> setpagedevice" -f page.pdf
My initial command worked well until I came across 1 pdf that lacked a Swedish special character (Å), so I found out that I could add the -dPDFX argument to make all the fonts to be included in the pdf
gs -o left_sections.pdf -sDEVICE=pdfwrite -dPDFX -dAutoRotatePages=/None -g17700x6120 -c "[/CropBox [0 0 1770 6120] /PAGES pdfmark" -dFIXEDMEDIA -c "<</PageOffset [0 0]>> setpagedevice" -f page.pdf
So far so good. Except that in the end, I need to convert all fonts to outlines (with -dNoOutputFonts). What I did notice was that if the pdf included a SMASK (I can't control this), the actual page was transformed to an image and that specific page could understandable not be converted to outlines, since it's an image now. So I cant use the -dPDFX argument.
I think I've tried with all possible arguments in different combinations that I've found.
-dPDFSETTINGS=/prepress
-dPDFSETTINGS=/printer
-dPDFA
-dEmbedAllFonts=true
-c "<</NeverEmbed []>> setdistillerparams"
-dSubsetFonts=true
What am I doing wrong?
I'm using Ghostscript 9.21 on a Mac OSX 10.10.5. The pdf that I'm trying to split is https://nofile.io/f/dxJQh2bDNOv/page.pdf. The result with my first command is https://nofile.io/f/NZHMhRUwNEe/left_sections.pdf
Upvotes: 0
Views: 864
Reputation: 31199
OK point one; you aren't splitting a PDF file in half. You are creating a new PDF file, none of its internal content will be the same as the original, the only goal of the device is that it should be visually identical to the input.
The reason the page is rendered when you specify PDF/X is because the PDF/X specification does not permit transparency (an SMask is a transparency operation) to be used. So the only way to get visually correct output is to render the content to an image. So don't do that.
Similarly you should not use PDFA or any other such format unless you need that format.
As regards embedding fonts, the pdfwrite device by default embeds all fonts. If a font is missing then it will use a default font.
Its impossible to say what (if anything) you are doing wrong without seeing the original PDF file which caused your problem (the Aring glyph problem). If you'd like to post that somewhere, along with information on which version of Ghostscript you are using, on what operating system, and where you sourced it from, then I could take a look at that.
However, my advice would be don't use PDFX or PDFA because these will result in the output file being restricted in its capabilities.
Upvotes: 0