I have the following statements in a servlet to create a PDF file from FO file. Meanwhile, I also added a chinese font to FOP to generate a PDF file with chinese character. ByteArrayOutputStream out1 = new ByteArrayOutputStream(); log = new ConsoleLogger(ConsoleLogger.LEVEL_WARN); MessageHandler.setScreenLogger(log); FileInputStream file = new FileInputStream(new File ("C:\\eFactoring_Data\\ADVICE\\EditFinancing_AdvC_TX_tx1.xml.fo")); InputSource foFile = new InputSource(file); foFile.setEncoding("UTF-8"); Driver driver = new Driver(foFile, out1); Options options = new Options(new File("./fo/userconfig.xml")); driver.setLogger(log); driver.setRenderer(Driver.RENDER_PDF); driver.run(); ***** Font in userconfig.xml ***** <font metrics-file="c:\FONTS\MingLiU.xml" kerning="yes" embed- file="c:\FONTS\mingliu.ttc"> <font-triplet name="MingLiU" style="normal" weight="normal"/> <font-triplet name="MingLiU" style="normal" weight="bold"/> </font> </fonts> This servlet is works OK in J2EE server. However , when I deployed in websphere, the generated PDF seem to be corrupted and not able to view by Acrobat Reader. The Websphere console have about 3000 lines logged like below: [2002/7/30 16:11:37:625 CST] 447ecfb2 SystemOut U illegal char value -23 [2002/7/30 16:11:37:625 CST] 447ecfb2 SystemOut U illegal char value -17 [2002/7/30 16:11:37:625 CST] 447ecfb2 SystemOut U illegal char value 120 [2002/7/30 16:11:37:625 CST] 447ecfb2 SystemOut U illegal char value -26 [2002/7/30 16:11:37:625 CST] 447ecfb2 SystemOut U illegal char value 124 [2002/7/30 16:11:37:625 CST] 447ecfb2 SystemOut U illegal char value -22 [2002/7/30 16:11:37:641 CST] 447ecfb2 SystemOut U illegal char value -21 [2002/7/30 16:11:37:641 CST] 447ecfb2 SystemOut U illegal char value -15 [2002/7/30 16:11:37:641 CST] 447ecfb2 SystemOut U illegal char value 120 [2002/7/30 16:11:37:641 CST] 447ecfb2 SystemOut U illegal char value -16 [2002/7/30 16:11:37:656 CST] 447ecfb2 SystemOut U illegal char value -98 What is the problem ? Is FOP with additional fonts not support in websphere ?
The output seems to come from the ASCII85Filter which encodes the compressend character stream for PDF text into printable characters. This has nothing to do with fonts or whatever. Inspection of the code doesn't turn up anything sispucious, and it is very unlikely that this well tested routine has a bug. ThHerefore the most likely explanation is a bug in the JVM, check whether your WebSphere uses a recent conformant JVM version, or at least the same as the server where your example works. Another possibility is a corrupted fop.jar, but the JVM should have caught this too.
*** Bug 13927 has been marked as a duplicate of this bug. ***
*** Bug 14387 has been marked as a duplicate of this bug. ***
Hi, I had the same problem when using TTF on UNIX. There are two things to consider: TTF must be copied in binary mode from Win32 to UNIX, and the encoding of the font-metrics file must be correct. The simplest way, which worked fine, is to omit the encoding statement. MM
batch transition to closed remaining pre-FOP1.0 resolved bugs