6

I am using the ps2pdf14 utility that ships with Ghostscript, and I am having a problem with fonts.

It does not seem to matter what instructions I pass to the command, it insists on subsetting any fonts it finds in the source document.

e.g

-dPDFSETTINGS#/prepress 
-dEmbedAllFonts#true 
-dSubsetFonts#false 
-dMaxSubsetPct#0

Note that the # is because the command is running on Windows, it is the same as =.

If anyone has any idea how to tell ps2pdf not to subset fonts, I would be very grateful.

--------------------------Notes ------------------------------------------

The source file is a PDF containing embedded fonts, so it is the fonts already embedded in the source file, that I need to prevent being subset in the destination file.

Currently all source file embedded fonts are subset, in some cases this is not apparent from the font name, i.e it contains no hash, and appears at first glance to be the full font, however the widths array has been subset in all cases.

Kurt Pfeifle
  • 86,724
  • 23
  • 248
  • 345
Gavin
  • 2,153
  • 2
  • 25
  • 35

2 Answers2

5

I'm not sure what exactly you do want to achieve. Possibly no fonts at all embedded (not even as a subset)? Or is it "I want not subset, but the complete font"?

Note 1:

  • the ps2pdf14 utility is a batch file which invokes the real gswin32c.exe with a pre-set array of command line parameters. You are more flexible to experiment if you construct the gswin32c commandline fully on your own.

Note 2:

  • Ghostscript cannot un-embed fonts from a source PDF (at least AFAIK).

I have always had success controlling font embedding policies with the following commandlines:

  gswin32c.exe ^
    -dBATCH ^
    -dNOPAUSE ^
    -sOutputFile=c:/path/to/my/output.pdf ^
    -sDEVICE=pdfwrite ^
    -dPDFSETTINGS=/prepress ^
    -dCompressFonts=false ^
    -dSubsetFonts=false ^
    -dEmbedAllFonts=true ^
    -c ".setpdfwrite <</NeverEmbed [ ]>> setdistillerparams" ^
    -f c:/path/to/my/postscript.ps

The previous one embeds all fonts (even the "Base 14" ones), fully (no subsetting). The next one does not embed any fonts:

  gswin32c.exe ^
    -dBATCH ^
    -dNOPAUSE ^
    -sOutputFile=c:/path/to/my/output.pdf ^
    -sDEVICE=pdfwrite ^
    -dPDFSETTINGS=/default ^
    -dEmbedAllFonts=false ^
    -c ".setpdfwrite <</AlwaysEmbed [ ]>> setdistillerparams" ^
    -f c:/path/to/my/postscript.ps

Note 3:

  • the .setpdfwrite part invokes defaults deemed to be beneficial for PDF creation. If it appears last on the commandline, it may override what you did set before. Hence the /NeverEmbed [ ] and/or /AlwaysEmbed [ ] p parts added afterwards, just before invoking the input file.
Kurt Pfeifle
  • 86,724
  • 23
  • 248
  • 345
  • Thanks for the answer Kurt. Just for the clarity of any future reader. The purpose of my question was to keep full fonts in the source document, intact in the destination document, the ultimate aim being font reuse, so a user could edit a pdf and reuse the existing fonts for their edits, without needing the font on their system. – Gavin May 08 '13 at 20:14
  • As of `gs` version 9.50, the `.setpdfwrite` operator has been [deprecated](https://www.ghostscript.com/doc/9.50/Language.htm), since it just sets a minimum 3 MB vmthreshold to allow for accumulating shared object data and to reduce the incidence of garbage collection as a performance improvement. You will have to drop it from your solution to continue working after `gs` version 9.54, as it will fail to run without an error. – ikaerom Jan 05 '22 at 23:11
0

Try creating a settings file containing:

<< /SubsetFonts false >> setdistillerparams

Dwight Kelly
  • 1,232
  • 2
  • 11
  • 17