Problem:  generated PDF file shows '#' characters instead of Chinese characters.

So I dug around on the faqs and archives and didn't see a specific example that shows how to accomplish what
I'm trying to do....  heres the problem, I have a xslt file which gets loaded and transformed via java code.

The transformation does the following:

1) Creates a .fo file
2) Calls an XSLT extension to generate the PDF file, using the .fo file it just produced

In detail here what I do.

Java code executes Transformation-> transformation creates .fo file-->transformation then grabs file and passes it to a XSLT extension which produces the pdf file.


The XSLT extension java code looks like

public static void createPDF (String foFileName, String pdfFileName)  {

â.. do setup work

//  Create a new FOP driver object
Driver driver = new Driver();
               
//  Setup FOP with a logger
Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_INFO);
driver.setLogger(logger);
MessageHandler.setScreenLogger(logger);
       
//  Setup FOP to render PDF        
driver.setRenderer (Driver.RENDER_PDF);
               
//  Create an output stream for the pdf file and tell FOP about it
out = new java.io.FileOutputStream (pdfFile);
driver.setOutputStream (out);

//  Create an input stream for the fo file and tell FOP about it
in = new java.io.FileInputStream (foFile); driver.setInputSource (new InputSource (in));
       
//  Generate the output
driver.run();

the xslt for the extension looks like

<xsl:value-of select="java:com.xxx.core.internal.XSLT.XSLTExtension.createPDF($foFullPathName, $reportFullPathName)"/>


This all works great BUT!!!!!! The problem is that on Chinese if I have text that has Chinese characters they are replaced with â#â characters, and I can figure no way around thisâ.

Soâ. Digging around I see that I need to embed fonts, butâ...

How do I do this programmatically?
How do I do this so it works on Windows and Linux?

Reply via email to