Note that there are some explanatory texts on larger screens.

plurals
  1. POI can't change my Font Family using Apache FOP
    primarykey
    data
    text
    <p>I use fop <a href="http://xmlgraphics.apache.org/fop/quickstartguide.html" rel="nofollow">Quick Start Guide</a> to print a simple PDF file from simple XML file and it works fine. but when I change <code>&lt;name&gt;Frank&lt;/name&gt;</code> to <code>&lt;name&gt;امیررضا&lt;/name&gt;</code> (change name to other encoding) I get <code>####</code> in my printed PDF. I search through Internet and didn't found any feasible solution. I use many config file here is some of my config file:</p> <p>I use this command for creating pdf: </p> <pre><code>fop -c cfg.xml -xml name.xml -xsl name2fo.xsl -pdf name.pdf </code></pre> <p>When I use this command I get below warning:</p> <pre><code>WARNING: xHeight value could not be determined. The font may not work as Sep 15, 2011 9:15:37 AM org.apache.fop.events.LoggingEventListener proce WARNING: Glyph "╙" (0x633, afii57427) not available in font "Helvetica". Sep 15, 2011 9:15:37 AM org.apache.fop.events.LoggingEventListener proce WARNING: Glyph "╘" (0x634, afii57428) not available in font "Helvetica". </code></pre> <p>1- name.xml contains:</p> <pre><code>&lt;name&gt;امیررضا&lt;/name&gt; </code></pre> <p>2-name2fo.xsl contains:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"&gt; &lt;xsl:output method="xml" indent="yes"/&gt; &lt;xsl:template match="/"&gt; &lt;fo:root&gt; &lt;fo:layout-master-set&gt; &lt;fo:simple-page-master master-name="A4-portrait" page-height="29.7cm" page-width="21.0cm" margin="2cm"&gt; &lt;fo:region-body/&gt; &lt;/fo:simple-page-master&gt; &lt;/fo:layout-master-set&gt; &lt;fo:page-sequence master-reference="A4-portrait"&gt; &lt;fo:flow flow-name="xsl-region-body"&gt; &lt;fo:block&gt; Hello, &lt;xsl:value-of select="name"/&gt;! &lt;/fo:block&gt; &lt;/fo:flow&gt; &lt;/fo:page-sequence&gt; &lt;/fo:root&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p>3- have try many different config file (cfg.xml).</p> <p>3.1:</p> <pre><code>&lt;fop version="1.0"&gt; &lt;renderers&gt; &lt;renderer mime="application/pdf"&gt; &lt;fonts&gt; &lt;substitutions&gt; &lt;substitution&gt; &lt;from font-family="Helvetica" /&gt; &lt;to font-family="SansSerif"/&gt; &lt;/substitution&gt; &lt;/substitutions&gt; &lt;referenced-fonts&gt; &lt;match font-family=".*"/&gt; &lt;/referenced-fonts&gt; &lt;!-- register all the fonts found in a directory and all of its sub directories (use with care) --&gt; &lt;directory recursive="true"&gt;G:\....\fop\fop-1.0\Core14_AFMs&lt;/directory&gt; &lt;!-- automatically detect operating system installed fonts --&gt; &lt;auto-detect/&gt; &lt;font embed-url="C:\WINDOWS\Fonts\times.ttf"&gt; &lt;font-triplet name="Times New Roman" style="normal" weight="normal"/&gt; &lt;/font&gt; &lt;/fonts&gt; &lt;/renderer&gt; &lt;/renderers&gt; &lt;/fop&gt; </code></pre> <p>3.2:</p> <pre><code>&lt;fop version="1.0"&gt; &lt;renderers&gt; &lt;renderer mime="application/pdf"&gt; &lt;fonts&gt; &lt;substitutions&gt; &lt;substitution&gt; &lt;from font-family="Helvetica" /&gt; &lt;to font-family="SansSerif"/&gt; &lt;/substitution&gt; &lt;/substitutions&gt; &lt;referenced-fonts&gt; &lt;match font-family=".*"/&gt; &lt;/referenced-fonts&gt; &lt;!-- automatically detect operating system installed fonts --&gt; &lt;auto-detect/&gt; &lt;/fonts&gt; &lt;/renderer&gt; &lt;/renderers&gt; &lt;/fop&gt; </code></pre> <p>3.3: ......</p> <p>The result output is: </p> <blockquote> <p>Hello, #######!</p> </blockquote> <p>Can anyone help me fix this?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload