How to - Embed TrueType fonts in PDF output

If you need to embed the True Type fonts in the PDF output, you must add (from the XML View) the following property in your template, as direct child of the <xfd:document> element:

<xf:pdf-page-settings embed-true-type-fonts="true|false|subset" />

Depending on your document requirements, you can choose to dynamically set the value of the "embed-true-type-fonts" property, using a given value from your data source.

In order to obtain the desired output, two solutions are available:

Solution 1. Enclose the "embed-true-type-fonts" value in accolades as in below example:

<xf:pdf-page-settings embed-true-type-fonts="{/root/@EmbeddedFonts}" />

Solution 2. Give the dynamic value using the <xfd:attribute-value/> element, which allows you to dynamically change a property of an element at rendering time. This solution also allows you to add an additional rule to change the property conditionally, if needed.

The properties you need to specify are the following:

  • object - this property indicates the ID of the targeted element (in this case, the "xf:pdf-page-settings" element).
    Note: The target element must have the property "fo:id" set as well (make sure to use the "fo" namespace)
  • attribute - the name of the property you want to modify (in this case, the "embed-true-type-fonts" attribute);
  • dynamic-value - Since the value of the "embed-true-type-fonts" attribute is not known at design time, you must use "dynamic-value" to provide the XPath where the value resides in the input, to be used at rendering time.
  • condition [optional]  - a circumstance that specifies when the dynamic value is implemented. You can also use XPath here (use a flag from the input, for example condition="/root/@UseEmbedValueFromXML = true")
<xf:pdf-page-settings fo:id="35DF23A9"/>
<xfd:attribute-value object="35DF23A9" attribute="embed-true-type-fonts" dynamic-value="/root/@EmbeddedFonts"/>

Note that the <xfd:attribute-value/> element must be a direct child of <xfd:document/>

Have more questions? Submit a request

Comments

Powered by Zendesk