DynaPDF Manual - Page 198

Previous Page 197   Index   Next Page 199

Function Reference
Page 198 of 839
It is also possible to redirect all error messages and warnings into the error log of DynaPDF.
See SetErrorMode() for further information.
The OnFontNotFont callback function is called when a non-embedded font is not available
and if no alternative font could be found on the system (DynaPDF uses already a mapping
table to find good alternative fonts for many common fonts). Note that many PDF files
contain invalid font names. Since PDF files created by a specific application use mostly a
unique naming scheme, it is often possible to create your own mapping table for specific font
names so that such files can still be converted.
If your application knows a suitable alternate font then you can replace the PDF font with
the new one with ReplaceFont() or ReplaceFontEx(). The return value of the callback function
must be the retun value of ReplaceFont() or ReplaceFontEx() in this case. If no suitable
alternate font is known, then you can try to use a default font like Arial or return -1 to break
processing. A standard replacement font should be loaded with ReplaceFont().
CheckConformace() checks whether the alternate font contains compatible glyph metrics and
whether all required glyphs are avaialble. Although it is very often possible to replace
unknown fonts with Arial, it should be checked whether the appearance of the new font is
acceptable.
Since different fonts use different glyph widths, text rendered with a replacement font looks
often not as good as if the same text was rendered with a standard font that a viewer used to
display the text, also if the same font was used in both cases.
The reason why this happens is very simple: When a PDF viewer uses a standard font to
display text of a non-available font, then glyphs will be scaled to the widths of the original
non-embedded font (the glyph widths are stored in the PDF file). That is the reason why it is
often not noticeable that a text was rendered with an alternate font.
However, this scaling is no longer available when the font becomes embedded. To achieve
the same result it would be required to create a synthetic font that contains scaled outlines
for every glyph but such a feature is not available in DynaPDF.
The OnReplaceICCProfile callback function is called when an additional default ICC based
color space must be created (this is the case when a page uses mixed color spaces), or when a
PDF file contains either damaged or ICC profiles of an unsupported version.
It is relatively seldom required to replace embedded ICC profiles but it is often required to
create additional default color spaces. So, it is very important that this callback function is
present. In the callback function you must call ReplaceICCProfile() with the requested color
profile type or return -1 if no such profile is available. The return value of the callback
function must be set to the one of ReplaceICCProfile().
The most common ICC profiles, which are also used in Adobes Acrobat or Reader, can be
downloaded from the Adobe website. These profiles are freely available and can be
 

Previous topic: General requirements when creating PDF/A files:

Next topic: Type3 font conversion, Summay, Normalization