3

PREFACE

I understand this is a little harder since I can't provide the actual pdf, but the question boils down to a more general ghostscript config question so I don't think the pdf is needed.


I have a pdf. I am trying to repair with ghostscript. It is trying to use the font STHeitiSC-Light which is supposed to be embedded in the pdf, but it doesn't appear to be correctly embedded. I tried to fix it with popplerutils; when I run

pdftocairo -pdf bad_pdf.pdf repaired.pdf

I get this super informative error message:

some font thing failed
some font thing failed

gs -o repaired.pdf -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress bad_pdf.pdf

I get

    **** Warning: can't process font stream, loading font by the name.
Can't find CID font "STHeitiSC-Light".
Attempting to substitute CID font /Adobe-Identity for /STHeitiSC-Light,
  see doc/Use.htm#CIDFontSubstitution.
The substitute CID font "Adobe-Identity" is not provided either.
  attempting to use fallback CIDFont.See doc/Use.htm#CIDFontSubstitution.
The fallback CID font "CIDFallBack" is not provided.
Finally attempting to use ArtifexBullet.
     **** Error reading a content stream. The page may be incomplete.
     **** File did not complete the page properly and may be damaged

So, I made sure I have STHeitiSC-Light installed on my system. I added a ttf to

/usr/share/fonts/truetype/STHeitiSC-Light.ttf

And I updated my cidfmap with

/STHeitiSC-Light << /FileType /TrueType /Path (/usr/share/fonts/truetype/STHeitiSC-Light.ttf) /SubfontID 0 /CSI [(Identity) 0] >> ;

But the error still persists, so I'm not sure what to do. There is some text in the pdf using this font, I don't even care that the font is preserved, but currently, the pdf is rendered with that text blanked out.

  • 1
    If nobody else has an idea: Make another pdf with embedded STHeitiSC-Light. Using mutool clean -d if necessary, identify the embedded font in the original pdf in an editor, and replace with the correct stream from the other pdf. Fixup object table with pdftk or whatever comes handy. (It's hard to answer this question without being able to look at the damaged pdf). – dirkt Jul 19 '17 at 19:16
  • That might fix this particular pdf, but doesn't answer in general how to make ghostscript recognize the installed font and use it – chiliNUT Jul 26 '17 at 18:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.