This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Help required regarding special character representation in PDF generated using FOP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Help required regarding special character representation in PDF generated using FOP" Watch "Help required regarding special character representation in PDF generated using FOP" New topic
Author

Help required regarding special character representation in PDF generated using FOP

anekh sunamo
Greenhorn

Joined: Nov 26, 2004
Posts: 3
I am using FOP version 0.20.5 for generating a PDF. Whenever a special character is encountered, they are getting displayed as hash ("#") in the PDF. Can anyone give an idea how to go about this.
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Which font are you using in the generated PDF? Does that font have the special character your input file uses?


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
anekh sunamo
Greenhorn

Joined: Nov 26, 2004
Posts: 3
We are using sans-serif font. We are getting the special char from word document. for example: "This is � the special char" The hypen we get from word document is not the mormal ANSI hypen. This seems to be a double byte char. And the Hypen is displayed as # in PDF. We are using FOP.jar for pdf generation.
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Ok. So apparently the default sans-serif font (sans-serif is just a "family" of fonts, if you weren't aware of that) used by FOP doesn't handle your specific special character too well. Could you try another font?
anekh sunamo
Greenhorn

Joined: Nov 26, 2004
Posts: 3
We tried with fonts like Arial, Courier but the special characters remained same.
Now we passed UTF-8 encoding to the InputStreamReader. Looks like it works but generates an extra character - �.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help required regarding special character representation in PDF generated using FOP
 
Similar Threads
problem in handling special characters in XML using FOP
XHTML to PDF Transformation
rendering TIF image in PDF
Problem in handling special characters using FOP generating pdf
HTML/PDF FOP - Newline Character