Extract embedded PDF fonts to an external ttf file using some utility or script

后端 未结 5 1541
小蘑菇
小蘑菇 2020-12-17 07:26

Is it possible to extract fonts that are embedded in a PDF file to an external ttf file using some utility or script?

  1. If the fonts that are embedded (or not

5条回答
  •  孤城傲影
    2020-12-17 07:49

    It's a late answer but I found a way to do this using freely available windows programs. Won't require scripting or compiling or cygwin. It's a few steps but not as bad as it looks.

    1. Install mupdf link - http://mupdf.googlecode.com/files/mupdf-0.8.15-windows.zip and copy your pdf to mupdf's installation folder. Let's say it's called whatever.pdf.

    2. Open a dos/command prompt. Navigate to your mupdf install folder. example: cd C:\Program Files\mupdf ...If that goes smoothly, your prompt should now look like this: C:\Program Files\mupdf> Now type the following command: pdfextract whatever.pdf

    Afterwards, within the mupdf program folder, you'll have one or more font files. They'll have names like ABCDEF+Fontname-12.cff ...Right now they're in the unusable .cff format but we'll fix that. I recommend renaming this to something less awkward... for example whatever.cff

    1. More DOS, sorry. You need a tool called cfftot1.exe. Here's a link: ftp://tug.org/texlive/Contents/live/bin/win32/cfftot1.exe ...Copy it to your mupdf folder. Then type this: cfftot1 whatever.cff whatever.pfb

    2. You now have an almost usable font file called whatever.pfb. I say 'almost' because usually PFB font files also come with a 2nd file, a PFM file which contains spacing information. Without this file the font won't install and the spacing will be screwed up. But the font will still open in font editors like fontlab. You can save the font from there to TTF or OTF. You can also try fixing the spacing yourself.

    If you don't have a font editor, you can use crossfont. Crossfont can take the PFB and generate the necessary PFM file so you can at least install and use the font. link - http://crossfont.en.softonic.com/

    That's it.

提交回复
热议问题