Xojo Conferences

DynaPDF Manual - Page 176

Previous Page 175   Index   Next Page 177

Function Reference
Page 176 of 767
was executed. The required ICC profile must be attached depending on the return value of
the function (see Return Values beow).
With CheckConformance() you can check whether prohibited features were used. Once the right
settings are found, it is normally no longer required to call this function when creating new PDF
files. The parameter CheckOptions should be set to coDefault or to zero so that prohibited features
raise an exception.
If you have a license of the PDF/A Extension for DynaPDF, then you can also convert arbitrary
imported PDF files to PDF/A 1b, 2b, or 3b.
In this case, a few additional notes should be considered:
External CMaps should be loaded delayed with SetCMapDir() if possible. The CMaps are
sometimes required, especially for Asian PDF files.
It is strongly recommendet to set an error callback function before CheckConformance() is
executed. The function passes warnings and error messages to the callback function if set.
These messages should be stored in an error log so that the user can check whether changes
were made. Errors are always fatal; the return value is ignored in this case. When a warning
is passed to the error callback function (this is the case when something must be changed),
then the return value can be either 0 to accept the change or -1 to break processing. In the
latter case no PDF file will be produced.
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
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.

Previous topic: General requirements:

Next topic: Return values