PDFNetAddFontSubst Method (String, String) |
AddFontSubst functions can be used to create font substitutes
that can override default PDFNet font selection algorithm.
These functions are useful in situations where referenced fonts
are not present in the document and PDFNet font substitution
algorithm is not producing desired results.
AddFontSubst(fontname, fontpath) maps the given font name (i.e. 'BaseFont'
entry from the font dictionary) to a font file.
AddFontSubst(ordering, fontpath) maps the given character ordering (see
Ordering entry in CIDSystemInfo dictionary; Section 5.6.2 in PDF Reference)
to a font file. This method is less specific that the former variant of
AddFontSubst, and can be used to override a range of missing fonts (or
any missing font) with a predefined substitute.
The following is an example of using these functions to provide user
defined font substitutes:
Namespace:
pdftron
Assembly:
pdftron (in pdftron.dll) Version: 255.255.255.255
Syntax public static bool AddFontSubst(
string fontname,
string fontpath
)
Public Shared Function AddFontSubst (
fontname As String,
fontpath As String
) As Boolean
public:
static bool AddFontSubst(
[InAttribute] String^ fontname,
[InAttribute] String^ fontpath
)
pdftron.PDFNet.AddFontSubst = function(fontname, fontpath);
Parameters
- fontname
- Type: SystemString
The name of the font.
- fontpath
- Type: SystemString
The path of the font to use with the matching name.
Return Value
Type:
Boolean
True if successful.
Examples PDFNet.initialize();
PDFNet.setResourcesPath("c:/myapp/resources");
PDFNet.addFontSubst("MinionPro-Regular", "c:/myfonts/MinionPro-Regular.otf");
PDFNet.addFontSubst("Times-Roman", "c:/windows/fonts/times.ttf");
PDFNet.addFontSubst("Times-Italic", "c:/windows/fonts/timesi.ttf");
PDFNet.addFontSubst(PDFNet.e_Identity, "c:/myfonts/arialuni.ttf");
PDFNet.addFontSubst(PDFNet.e_Japan1, "c:/myfonts/KozMinProVI-Regular.otf");
PDFNet.addFontSubst(PDFNet.e_Japan2, "c:/myfonts/KozMinProVI-Regular.otf");
PDFNet.addFontSubst(PDFNet.e_Korea1, "c:/myfonts/AdobeSongStd-Light.otf");
PDFNet.addFontSubst(PDFNet.e_CNS1, "c:/myfonts/AdobeMingStd-Light.otf");
PDFNet.addFontSubst(PDFNet.e_GB1, "c:/myfonts/AdobeMyungjoStd-Medium.otf");
PDFDoc doc = new PDFDoc("c:/my.pdf");
See Also