Creating High Resolution PDF files for book production with Open Source tools

by Markus Neteler
1 Creating High Resolution PDF files for book production with Open Source tools
2 FAQ - Frequently asked questions
3 Embedding fonts in PDFLateX
4 Further Reading
5 Lookup table for font names

1 Creating High Resolution PDF files for book production with Open Source tools

A common problem for book authors is the delivering of their book in acceptable form as digital file. While Latex is doing a great job, a few tricks have to be known to prepare the book file correctly. Nowadays book editors seem to prefer high quality PDF files instead of Postscript files. This document describes how to arrive at an acceptable PDF file by using Open Source/Free Software tools. Important to know is that prepress machines seem not to provide any font! So all fonts need to be embedded.

This page reflects our experiences with a major publisher; finally, after trying various ways, we found a simple solution which we explain below.

Installation prerequisites:

Recommendations for final PDF file:

Figures, diagrams, ...


The conversion from DVI to PDF:

Heart-and-soul of having success is to convert the DVI file correctly to high resolution PDF. The following code is a real world example for a book published by Kluwer Academic Publishers/Springer, Boston/New York:
#prepare the DVI file:
latex mybook.tex
bibtex mybook.tex
latex mybook.tex

#render the high resolution PDF from the DVI file:
export MYBOOKDVI=mybook.dvi
export MYBOOKPDF=mybook_highres.pdf

DVIPS=dvips -j0 -Ppdf -Pdownload35 -G0 -t letter -D 1200 -Z -mode ljfzzz

#REDHAT 9 (, : assume K Berry names - Kluwer however uses 'Dvipsone' names):
# Note: there is a bug in the font mapping on Redhat9 ( contains Nimbus...):
#       however, it works fine on Mandrake.
#DVIPS=dvips -j0 -Ppdf -u -G0 -t letter -D 1200 -Z -mode ljfzzz

# ... seems to be similar to Redhat9 ...

# -j0 -G0: tells dvips to embed the fonts 100%
# -Pdownload35 or -u configuration of PostScript Type 1 fonts
# - Dvipsone Names: they have to be activated in the style file of the publisher

${DVIPS} ${MYBOOKDVI} -o - | gs -q -dNOPAUSE -dBATCH \
	-sDEVICE=pdfwrite -dPDFSETTINGS=/prepress\
	-dCompatibilityLevel=1.3 \
	-dCompressPages=true -dUseFlateCompression=false \
	-sPAPERSIZE=letter \
	-dSubsetFonts=true -dEmbedAllFonts=true \
	-dProcessColorModel=/DeviceGray \
	-dDetectBlends=true -dOptimize=true \
	-dDownsampleColorImages=true -dColorImageResolution=1200 \
	-dColorImageDownsampleType=/Average -dColorImageFilter=/FlateEncode \
	-dAutoFilterColorImages=false -dAntiAliasColorImages=false \
	-dColorImageDownsampleThreshold=1.50000 \
	-dDownsampleGrayImages=true -dGrayImageResolution=1200 \
	-dGrayImageDownsampleType=/Average -dGrayImageFilter=/FlateEncode \
	-dAutoFilterGrayImages=false -dAntiAliasGrayImages=false \
	-dGrayImageDownsampleThreshold=1.50000 \
	-dDownsampleMonoImages=true -dMonoImageResolution=1200 \
	-dMonoImageDownsampleType=/Average -dMonoImageFilter=/FlateEncode \
	-dAutoFilterMonoImages=false -dAntiAliasMonoImages=false \
	-dMonoImageDownsampleThreshold=1.50000 \
	-sOutputFile=${MYBOOKPDF} \
	-c save pop -

#now you should find the PDF in the local directory.
Of course you can insert above into a neat script (e.g. a Makefile to create the DVI/PDF files).

The publisher's PDF preflight should now run well.

2 FAQ - Frequently asked questions

  1. Font problems - you see something like this in ps2pdf:
       dvips: Font Helvetica used in file figures/gstat_ln_zinc1.eps is not in the mapping file.
       dvips: Font Helvetica-Bold used in file figures/R_ecdf_elev_int.eps is not in the mapping file.
       dvips: Font Helvetica-Oblique used in file figures/R_ecdf_elev_int.eps is not in the mapping file.
       dvips: Font Helvetica-BoldOblique used in file figures/R_ecdf_elev_int.eps is not in the mapping file.
       dvips: Font Symbol used in file figures/R_ecdf_elev_int.eps is not in the mapping file.
    or something like this in Acrobat Distiller (prepress settings):
       %%[ Warning: Helvetica not found, using Font Substitution. Font cannot be embedded.]%% 

    This problem can be solved by changing the fonts in the EPS file(s). The problem arises from the fact that standard PostScript fonts are not embedded, but for prepress stage we need all fonts embedded.

    Solution: You can happily edit EPS files with a text editor (nedit, gedit, ...) and replace the font names according to this table:

     Name Translation table:
     GhostScript fonts                     | PostScript name   | 	URW Name (use for embedding)
      Nimbus Sans L Regular			 Helvetica		NimbusSanL-Regu
      Nimbus Sans L Regular Italic		 Helvetica		NimbusSanL-ReguItal
      Nimbus Sans L Bold			 Helvetica		NimbusSanL-Bold
      Nimbus Sans L Bold Italic		 Helvetica		NimbusSanL-BoldItal
      Nimbus Sans L Regular Condensed 	 Helvetica Narrow	NimbusSanL-ReguCond
      Nimbus Sans L Regular Condensed Italic Helvetica Narrow	NimbusSanL-ReguCondItal
      Nimbus Sans L Bold Condensed		 Helvetica Narrow	NimbusSanL-BoldCond
      Nimbus Sans L Bold Condensed Italic 	 Helvetica Narrow	NimbusSanL-BoldCondItal
      Nimbus Roman No9 L Regular	 	 Times			NimbusRomNo9L-Regu
      Nimbus Roman No9 L Regular Italic 	 Times			NimbusRomNo9L-ReguItal
      Nimbus Roman No9 L Medium 		 Times			NimbusRomNo9L-Medi
      Nimbus Roman No9 L Medium Italic 	 Times			NimbusRomNo9L-MediItal
      Standard Symbols L 			 Symbol			StandardSymL
    Note: See at page bottom for a more complete table.

    Example: After changing 'Helvetica' to 'NimbusSanL-Regu' in the EPS file, this font will be embedded into the final PDF file.

    Since we are lazy, we let the computer do this change-the-names job:

      # We go for replacing the wrong commercial font names with URW names, we also
      # adapt some similar fonts names on the fly (extend for further font names):
      cat original_graphics.eps | sed 's+Times-Bold+NimbusSanL-Bold+g' |\
       sed 's+Times-Roman+NimbusSanL-Regu+g' |\
       sed 's+Times+NimbusSanL-Regu+g' |\
       sed 's+Helvetica-BoldOblique+NimbusSanL-BoldItal+g' |\
       sed 's+Helvetica-Oblique+NimbusSanL-ReguItal+g' |\
       sed 's+Helvetica-Bold+NimbusSanL-Bold+g' |\
       sed 's+Helvetica-Bold-iso+NimbusSanL-Bold+g' |\
       sed 's+Helvetica+NimbusSanL-Regu+g' |\
       sed 's+Helvetica-iso+NimbusSanL-Regu+g' |\
       sed 's+Symbol+StandardSymL+g' > new_graphics.eps
    Now use the fixed EPS files in your Latex document, the changed names will enforce the font embedding into the final PDF file.

  2. Preparation of EPS files from raster images with OpenOffice/StarOffice:
    When exporting to EPS OpenOffice has 2 options for Text settings:
    - Always export glyph outlines
    - Never export glyph outlines
    The default is 'Always export...' and that integrates the text into image. When changing to 'Never export...' the fonts get defined in the EPS file (we checked it in a text editor so we know that it is in there).

    However, the EPS file from OpenOffice was still different from the one from StarOffice, so StarOffice might be preferred to create EPS. StarOffice does not have the Text settings option and always includes the font definition. When keeping fonts e.g. Times-Bold the resulting EPS file must be run through above 'sed' script to change to Nimbus.

  3. How to convert a PS file to EPS?

    The only functional program is ps2eps from Roland Bless. All other programs are rubbish. For e.g. Linux, you may get it through the "texlive-pstools-bin" and "texlive-pstools" RPM packages.

3 Embedding fonts in PDFLateX

You created your PDF document with "pdflatex" and need to deliver it to your publisher but they complain that the fonts are not embedded? There is an easy solution to this. Note that all tricks with setting "pdftexDownloadBase14" to true etc failed for me. So, simply do this:
# convert to Postscript
pdftops main.pdf

# reconvert to PDF but enforce font embedding (note, hyperlinks will not survive)
ps2pdf14 -dPDFSETTINGS=/prepress -dEmbedAllFonts=true main2.pdf

# verify
pdffonts main2.pdf
Now all fonts should be embedded and your publisher happy.

4 Further Reading

While most publisher's pages do not address the above issues, here is a list of helpful documents:

5 Lookup table for font names

Font name (sorted) Alternative name   Font name Alternative name (sorted)
AvantGarde-Book URWGothicL-Book Helvetica-BoldItalic Arial-BoldItalic
AvantGarde-BookOblique URWGothicL-BookObli Helvetica-Italic Arial-Italic
AvantGarde-Demi URWGothicL-Demi NewCenturySchlbk-Bold CenturySchL-Bold
AvantGarde-DemiOblique URWGothicL-DemiObli NewCenturySchlbk-BoldItalic CenturySchL-BoldItal
Bookman-Demi URWBookmanL-DemiBold NewCenturySchlbk-Italic CenturySchL-Ital
Bookman-DemiItalic URWBookmanL-DemiBoldItal NewCenturySchlbk-Roman CenturySchL-Roma
Bookman-Light URWBookmanL-Ligh Courier-BoldItalic CourierNew-BoldItalic
Bookman-LightItalic URWBookmanL-LighItal Courier-Italic CourierNew-Italic
Courier NimbusMonL-Regu ZapfDingbats Dingbats
Courier-Bold NimbusMonL-Bold Courier-Bold NimbusMonL-Bold
Courier-BoldItalic CourierNew-BoldItalic Courier-BoldOblique NimbusMonL-BoldObli
Courier-BoldOblique NimbusMonL-BoldObli Courier NimbusMonL-Regu
Courier-Italic CourierNew-Italic Courier-Oblique NimbusMonL-ReguObli
Courier-Oblique NimbusMonL-ReguObli Times-Bold NimbusRomNo9L-Medi
Helvetica NimbusSanL-Regu Times-BoldItalic NimbusRomNo9L-MediItal
Helvetica-Bold NimbusSanL-Bold Times-Roman NimbusRomNo9L-Regu
Helvetica-BoldItalic Arial-BoldItalic Times-Italic NimbusRomNo9L-ReguItal
Helvetica-BoldOblique NimbusSanL-BoldItal Helvetica-Bold NimbusSanL-Bold
Helvetica-Italic Arial-Italic Helvetica-Narrow-Bold NimbusSanL-BoldCond
Helvetica-Narrow NimbusSanL-ReguCond HelveticaNarrow-Bold NimbusSanL-BoldCond
Helvetica-Narrow-Bold NimbusSanL-BoldCond Helvetica-Narrow-BoldOblique NimbusSanL-BoldCondItal
Helvetica-Narrow-BoldOblique NimbusSanL-BoldCondItal HelveticaNarrow-BoldOblique NimbusSanL-BoldCondItal
Helvetica-Narrow-Oblique NimbusSanL-ReguCondItal Helvetica-BoldOblique NimbusSanL-BoldItal
Helvetica-Oblique NimbusSanL-ReguItal Helvetica NimbusSanL-Regu
HelveticaNarrow NimbusSanL-ReguCond Helvetica-Narrow NimbusSanL-ReguCond
HelveticaNarrow-Bold NimbusSanL-BoldCond HelveticaNarrow NimbusSanL-ReguCond
HelveticaNarrow-BoldOblique NimbusSanL-BoldCondItal Helvetica-Narrow-Oblique NimbusSanL-ReguCondItal
HelveticaNarrow-Oblique NimbusSanL-ReguCondItal HelveticaNarrow-Oblique NimbusSanL-ReguCondItal
NewCenturySchlbk-Bold CenturySchL-Bold Helvetica-Oblique NimbusSanL-ReguItal
NewCenturySchlbk-BoldItalic CenturySchL-BoldItal Symbol StandardSymL
NewCenturySchlbk-Italic CenturySchL-Ital Bookman-Demi URWBookmanL-DemiBold
NewCenturySchlbk-Roman CenturySchL-Roma Bookman-DemiItalic URWBookmanL-DemiBoldItal
Palatino-Bold URWPalladioL-Bold Bookman-Light URWBookmanL-Ligh
Palatino-BoldItalic URWPalladioL-BoldItal Bookman-LightItalic URWBookmanL-LighItal
Palatino-Italic URWPalladioL-Ital ZapfChancery-MediumItalic URWChanceryL-MediItal
Palatino-Roman URWPalladioL-Roma AvantGarde-Book URWGothicL-Book
Symbol StandardSymL AvantGarde-BookOblique URWGothicL-BookObli
Times-Bold NimbusRomNo9L-Medi AvantGarde-Demi URWGothicL-Demi
Times-BoldItalic NimbusRomNo9L-MediItal AvantGarde-DemiOblique URWGothicL-DemiObli
Times-Italic NimbusRomNo9L-ReguItal Palatino-Bold URWPalladioL-Bold
Times-Roman NimbusRomNo9L-Regu Palatino-BoldItalic URWPalladioL-BoldItal
ZapfChancery-MediumItalic URWChanceryL-MediItal Palatino-Italic URWPalladioL-Ital
ZapfDingbats Dingbats Palatino-Roman URWPalladioL-Roma

© 2004, 2010, 2013 Markus Neteler (neteler AT
Last change: $Date: 2013-11-01 $