Export foreign characters to PDF?

Hi All,

I am using the Export to PDF smart service and my data contains foreign characters such as Russian, Chinese, etc. However, when the export generates the foreign characters are being written to the PDF as "#". To elaborate we use Export to Word then convert to PDF. 

Does anyone have a workaround to get foreign characters into a PDF using Export to PDF?

Thanks in advance...

  Discussion posts and replies are publicly visible

Parents
  • Hello Jaker,

    I don't have an specific workaround but I saw this error before and there are ideas you can look at.
    - When converting to PDF the library does not support the font (or the font itself doesn't contains that character)
    - Try to use a font and charset available all around (DOC, Appian, PDF Converter)
    - The encoding is not well specified,
    - Does the word document displays the special characters properly?

    Finally is you struggle too much I recommend consider the XSL-FO transformation with that you have little more control over this kind of things and additional you can control your pdf.

    Jose
  • Hi Josep, I am using PDF from XSL-FO smart service, but this is also not displaying characters as expected. I am passing a simple XML containing Japanese characters and associated XSL is also passed in. Any other consideration I am missing here. Thanks for your help!
  • Hello can you attach an example to reproduce the error ?
    Jose
  • BTW, Have you tried to use the Unicode?
     
    www.w3.org/.../

    Jose
  • XML Content- 

    <?xml version="1.0" encoding="UTF-8"?>
    <record>
    <name>Test</name>
    <friend>
    <!-- japanese unicode characters for 'hello'-->
    	<name>&#12371;&#12435;&#12395;&#12385;&#12399;</name>
    	<phNo>77890011</phNo>
    </friend>
    <friend>
    <!-- japanese plain characters for 'hello'-->
    	<name>こんにちは</name>
    	<phNo>32323232323</phNo>
    </friend>
    </record>

     

    XSL Content - 

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"	exclude-result-prefixes="fo">
    <xsl:template match="record">
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
      <fo:layout-master-set>
        <fo:simple-page-master master-name="my-page">
          <fo:region-body margin="1in"/>
        </fo:simple-page-master>
      </fo:layout-master-set>
    
      <fo:page-sequence master-reference="my-page">
        <fo:flow flow-name="xsl-region-body">
          <fo:block>Hello, <xsl:value-of select="name" />!</fo:block>
          <fo:block>
          	<fo:table>
          		 <fo:table-body>
          		 	<fo:table-row>
                    	<fo:table-cell border="solid 1px black" 
    
    			text-align="center" font-weight="bold">
                    		<fo:block>
                        		No.
                      		</fo:block>
                    	</fo:table-cell>
                    	<fo:table-cell border="solid 1px black" 
    
    			text-align="center" font-weight="bold">
                    		<fo:block>
                        		Name
                      		</fo:block>
                    	</fo:table-cell>
                    	<fo:table-cell border="solid 1px black" 
    
    			text-align="center" font-weight="bold">
                    		<fo:block>
                        		Phone Number
                      		</fo:block>
                    	</fo:table-cell>
                    </fo:table-row>
                    <xsl:for-each select="./friend">
                    	<fo:table-row>
                    	<fo:table-cell border="solid 1px black" text-align="center">
                    		<fo:block>
                        		<xsl:value-of select="position()" />
                      		</fo:block>
                    	</fo:table-cell>
                    	<fo:table-cell border="solid 1px black" text-align="center">
                    		<fo:block>
                        		<xsl:value-of select="name" />
                      		</fo:block>
                    	</fo:table-cell>
                    	<fo:table-cell border="solid 1px black" text-align="center">
                    		<fo:block>
                        		<xsl:value-of select="phNo" />
                      		</fo:block>
                    	</fo:table-cell>
                    </fo:table-row>
                    </xsl:for-each>
          		 </fo:table-body>
          	</fo:table>
          </fo:block>
        </fo:flow>
      </fo:page-sequence>
    </fo:root>
    </xsl:template>
    </xsl:stylesheet>

  • Attached the XMl and XSL code. Also tried with UNICODE characters but the smart service is not recognizing them. Even I ran the same Java code on my system where I have installed all required fonts and still get the '#' characters in PDF. 

     

    In above XML code the unicode is converted to the original language. I used this UNICODE-

  • You need to make sure your font has the characters you want for example Times and Helvetica doesn't have it.
    take a look at this it explains it:
    * xmlgraphics.apache.org/.../faq.html

    If you want to make sure look the logs you maybe have something like this
    WARNING: Glyph "?" (0x3053, kohiragana) not available in font "Times-Roman".

    So, make sure your font is available in the OS , one font you can use is the "MS Mincho" it contains hiragana characters.

    Jose
  • 0
    Appian Employee
    in reply to josep
    docx to pdf smart service does not support other fonts than Times Roman, which in turn does not support many languages. I have tried different ways of coaxing it to work (embedding fonts, installing new ones, etc.) but to no avail.
    I have seen a plugin that uses the Aspose library for conversions, and the results are much nicer overall but the library is not free.
  • 0
    Appian Employee
    in reply to Mike Cichy
    Correction: If you are on-prem, as suggested, you can install fonts in the environment and it should work. You will not be able to install new fonts in Appian Cloud.
  • Maybe that can be a good enhancement to this plugin. 
    * xmlgraphics.apache.org/.../configuration.html (at the bottom it mentions "Relative URIs for those properties are evaluated relative to the base URI of the configuration file. If the configuration is provided programmatically, the base URI can be set with FopFactory.setUserConfigBaseURI ; default is the current working directory.")

    Not to install the fonts in the OS but to let us to add a configuration File or something like that, what do you think @Mike ?

    Jose

  • 0
    Appian Employee
    in reply to josep
    I have tried that to no avail. I could have made a mistake, but just did not have more time to burn to troubleshoot further.
Reply Children
No Data