I know Acrobat won't do it because of the licensing restrictions, etc.
Does anyone know any program that will just embed True Type fonts anyway in an existing PDF (or print with embedded fonts to a new PDF, etc.)?
To expound mark's answer:
The sample EmbedFontPostFacto.java (EmbedFontPostFacto.cs) from chapter 16 of iText in Action — 2nd Edition shows how you can embed a given True Type font in an existing PDF.
Be aware, though, that certain assumptions are made here, it's just an example after all. When generalizing the code for generic PDFs and fonts, the font dictionary should be checked more thoroughly and embedding the font file can require slightly different entries to be changed. In that case let the specification ISO 32000-1:2008 (especially chapter 9 Text) be your guide.
I believe Itext allows you to manipulate the fonts in a PDF file
Related
I am not a programmer, but a normal user who uses Linux.
I want to use Ghostscript to DISPLAY Pdf files, not to CREATE Pdf files. (I have never used Ghostscript until now).
But I want Ghostscript to automatically replace all fonts with other fonts when I open the PDF. No matter if the fonts are embedded or not.
With which fonts should the fonts be replaced?
Answer: I want to create a list of fonts, that I want to be available for replacement.
But which of these fonts on the list should be used?
Answer: The one that best matches the metric of the font to be replaced.
Is it possible to do this somehow?
You can't get Ghostscript to do what you are asking. If a PDF file contains fonts Ghostscript will use those fonts, it will only substitute if it cannot find an embedded font.
The reason for this is simple; the font embedded in the PDF file is the correct font. It's Metrics are correct, and the mapping form character code to the appropriate glyph selector in the font will be correct.
It's also a non-trivial problem to select from a list of fonts the one which 'best matches the metrics of the font to be replaced'. What characteristics should be considered ? How should those be determined ?
When a font is not embedded then Ghostscript will consult its own list of fonts and CIDFonts. Both of these lists can be customised, the documentation is here
But since a substitute font is always going to be a compromise, you can't tell Ghostscript not to use the embedded fonts in a PDF. Well technically you could, by modifying the PDF interpreter, but you say you aren't a programmer, so I doubt you will want to try that.
I'm adding the possibility to embed Truetype fonts in the PDFs generated by my application, but the fonts "Sitka Text" (and it's variants "Sitka Banner", "Sitka small" and etc) and "Meiryo" don't embed.
I believe it is because I'm using the name from the LOGFONT object and to these fonts I should be using the PostScript name.
How can I obtain the Postscript name?
I obtained the 'name' table with GetFontData but the result didn't return any name I could use.
Is there any method on WINAPI that gives me that name?
Edit: I only show to my users fonts with the embedding permissions "Editable" and "Installable" which I obtain with the methods EnumFontFamiliesEx and it's CALLBACK function.
I also checked the NEWTEXTMETRIC ntmFlags that shows all my fonts are NTM_TT_OPENTYPE.
Edit2: By don't embed I mean that the PDF readers don't show my font as embedded (and Acrobat doesn't show any text)
An example of the error.
SOLVED
first, I'd like to thanks Michael Mckeough and mkl, You guys are Awesome and helped me a lot, I checked my original font and it wasn't damaged and I didn't change the font bytes, but then I finally noticed that if you call GetFontData to a (.ttc) file it will crop the ttcf part and no PDF reader will be able to understand what font it was.
Ideally, you would find this in the "name" table of the font. It would be nameId 0x0006, in a form useful for your platform. The format of the name table is a part of the TrueType and OpenType specifications. (You can find a copy here Microsoft Typography OpenType spec Name). There can be an awful lot of entries in the table, or there may be few. In particular, the Postscript name may or may not be present in any given font. You will need to look through the table for nameID of 0x0006, and a form (language, platform, encoding) that you can use. For postscript names, you most likely want them to be English, ASCII encoded, for any platform.
However, it is unlikely that the font is not embedding for this reason! A more common reason is that it is not legal to embed this font. In the Microsoft Typography OpenType Spec OS/2 you will see a field named fsType. This field contains flags indicating under what circumstances this font is licensed to be embedded. No Reputable tool will embed or subset this font is these flags indicate is it not licensed to be embedded.
I see that "Sitka Text" is a MS Windows 10 font, freely distributed by windows. It seems unlikely that It would not be licensed for embedding. Interestingly, the tool I usually use for "looking at" a font quickly (Font Validator, which used to be available from Microsoft Typography, but appears to no longer be) tells me that the OS/2 record is invalid. That it specifies a type of 5, and the spec says that type 4 is the latest. The correct response to a request to embed would require access to the fsType field, and if the record format was unknown, it should "fail safe", and refuse to embed the font.
So this is the most likely reason that the font will not embed for you.
I have a PDF with Type 3 font embedded. How can I convert this Type 3 font to Type 1 font?
It's been many years since this was asked, but I'm posting for anyone else that ran into this problem (like me). The best solution is to regenerate the PDF with settings to avoid type 3 fonts. For example, if you make your figures with matplotlib, then you can follow the instructions here: http://phyletica.org/matplotlib-fonts/
If it is not possible to regenerate the PDF or would require too much time, I also found that the using convert (found in imagemagick) can help. As others have stated, you may lose information, but this will work in most cases: convert example.pdf example.pdf
You may not be able to; Type 3 fonts can contain any PostScript; Type 1 fonts can only contain a restricted subset.
Other answers suggest re-generating from source files to output Type 1 instead of Type 3 fonts. This is probably the best solution when feasible, but there are situations where it may be impossible (eg. if the source files or generation program are unavailable for any reason). Allow me to offer an alternate approach..
How to "convert away" Type 3 fonts
I was able to "convert away" the Type 3 fonts in a PDF figure by opening the file in Adobe Acrobat Pro, and then printing the file to Adobe PDF (a virtual printer provided by Adobe Distiller, part of the Professional suite). I'm using the Adobe Pro suite version 11 (ca 2012), but newer versions presumably can do the same. This action sounds circular, but what it actually does is gives you the opportunity to force rendering of fonts into a new PDF.
The default output settings in my version were sufficient to generate a PDF that was visually indistinguishable from the source PDF, but where all the Type 3 fonts were rendered directly as vector graphics (ie the output PDF contains NO font usage of any kind). The Acrobat print dialog (at least in my Windows version) also has both "Properties" and "Advanced" buttons where one can make all sorts of highly detailed adjustments to the output. These include things like the list of Type 1 fonts to embed (and the settings for partial embedding), output compatibility (I used Acrobat 6 / PDF 1.5), optional image downsampling, etc.
Note this procedure will probably result in a significantly larger PDF output file. In my case the offending text using Type 3 fonts was just a few dozen labels on a quarter-page figure, and the PDF file size grew by about 2x during this conversion; however the absolute size remained under 50kB, so the expansion did not matter for my purposes. For a larger document or one with more text using Type 3 fonts, the expansion might be more pronounced, so YMMV.
I am having problems creating PDF documents with fully embedded True Type fonts. I am printing from MS Word (and Indesign) to the Adobe 9.0 print driver. I can get .otf fonts to embed with no problem, but .ttf files will not embed. Is it possible to fully (not subset) embed these fonts? I am specifically having problems using WingDings. With other fonts, I have been able to find and purchase .otf versions and use those, but it does not appear that wingdings is available in this format and I do not know of another way to fully embed bullets (both sqaure and round).
The license for WingDings doesn't appear to allow you to fully embed them -- or too look at it another way, Acrobat doesn't appear to believe that it can fully embed them (and so subsets them instead). I'm not a copyright lawyer, so I'm not sure precisely what's allowed here, but here's some info that might help.
Install the font properties extension from Microsoft. This will give you much more information on the fonts properties. Once it's installed right-click on a WingDings font and and click on the 'Embedding' tab. You'll see this message:
"Embeddability for this font: Editable embedding allowed.
Editable embedding allowed: fonts may be embedded in documents, but must only be installed
temporarily on the remote system."
Then read this article from Adobe about Embedding Permissions. And this forum discussion might be of some use too.
I tried print a Word document which included WingDings to the Adobe PDF printer driver (Acrobat 8) and not matter which settings I tried, I was unable to get it to fully embed the font.
My guess is that Adobe interpret "Editable embedding allowed" to mean that you can only embed characters for the font which were included in the original document (i.e. embedded subset) and they are also the only ones which you can edit in the PDF.
I would try adding an additional page to the document that included every character in the font. Then use a different (non-Adobe) tool to delete that page. I don't have Windows so I can't tell you specifically how to do it. I can only tell you that I've used these kinds of tricks on other systems.
Well basically I'm finishing school in mid December so I'm just brushing up my resume and I'm wondering if there's a way to use custom fonts (in this case Calibri and Cambria) in a PDF file and make them render correctly on all computers.
Thanks in advance!
EDIT: I'm using MS Word 2007, but am open to suggestions
PDFs don't store text and fonts like other documents, they actually convert the font to vectors, that way no matter what font you use, the document displays exactly as expected. This is why searching for text inside the PDF is such a problem for 3rd party PDF Readers and why even Adobe themselves use to distribute 2 versions of Acrobat (one with text search, one without).
Another thing to keep in mind is, PDF isn't pixel exact, it's ratio exact. PDF readers generally do not use a 100% zoom level, instead most people read them at "fit to screen" or "fit to page". I point this out because I'm guessing the reason you are trying to use those new Vista/Office 2007 fonts is because of their LCD subpixel support (improves readability on LCD screens). This feature will not translate into the PDF, since the letter becomes a vector, subpixel information is lost, and even if it wasn't, becomes useless because the vector will be sized to something other than you intended at view time.
The PDF format is capable of embedding fonts, if the font has been marked embeddable by its creator. You'll have to check the software that's creating your PDF to see if it has the capability and how to enable it.
theoretically speaking, on technical side, embedding/not embedding ability, regarding the fonts, is settled with a special flag in font file (ttf or opentype or type1)
you can view this special embedding flag with any font editor program (I recommend
FontCreator (by High-logic)
http://www.high-logic.com/font-editor/fontcreator.html
with a free trial fully operative and without limitations
you can also change embedding/not embedding flag, but legally speaking, for the 99% of fonts commercially distributed, this breaks the license of font