Producing a PDF file with "CID TrueType" fonts

498 views Asked by At

I'm looking for a step-by-step guide to create a PDF file with sample text, referencing fonts of type "CID TrueType", while not having those fonts embedded.

For context, I'm debugging a production issue related to processing an actual PDF file. The file allegedly was produced by some software for generating reports. The PDF file in question has the following font situation:

$ pdffonts broken.pdf
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
Times New Roman,Bold                 CID TrueType      Identity-H       no  no  yes      3  0
Times New Roman,Bold                 CID TrueType      Identity-H       no  no  yes      4  0
Times New Roman                      CID TrueType      Identity-H       no  no  yes      5  0
Times New Roman                      CID TrueType      Identity-H       no  no  yes     10  0
Arial,Bold                           CID TrueType      Identity-H       no  no  yes     11  0
$

Unfortunately, since this file is from an actual customer, it's not possible to easily share the file around, even among co-workers.

Thus, before even getting to solving actual challenges such a file poses for our application, I am looking for a way to create a "minimal reproduction" PDF example that I can easily share around. Such sample file should sufficiently mimic the original PDF file in terms of fonts.

I've came up with the following sample.ps:

%!PS
/Arial
20 selectfont
72 700 moveto
(A summer river being crossed) show

/Times-Roman
20 selectfont
72 650 moveto
(how pleasing) show

/Times-Bold
20 selectfont
72 600 moveto
(with sandals in my hands!) show
showpage

However, a PDF produced from this sample.ps lists all fonts as Type 1 or TrueType, but not as CID TrueType:

$ gs -sDEVICE=pdfwrite -dEmbedAllFonts=false -o output.pdf sample.ps
# ...
Loading ArialMT font from /System/Library/Fonts/Supplemental/Arial.ttf... 5145024 3571205 11691560 8060049 1 done.
Loading NimbusRoman-Regular font from /usr/local/Cellar/ghostscript/10.01.2/share/ghostscript/10.01.2/Resource/Font/NimbusRoman-Regular... 5206968 3755189 11733704 8112801 1 done.
Loading NimbusRoman-Bold font from /usr/local/Cellar/ghostscript/10.01.2/share/ghostscript/10.01.2/Resource/Font/NimbusRoman-Bold... 5313448 3956352 11733704 8116398 1 done.
$
$ pdffonts output.pdf
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
Times-Roman                          Type 1            Standard         no  no  no       9  0
Times-Bold                           Type 1            Standard         no  no  no      10  0
Arial                                TrueType          Standard         no  no  yes      7  0
$

Any tips or pointers for how to mimic the original file?

0

There are 0 answers