Jump to content
We've recently updated our Privacy Statement, available here ×

PDF Encoding not working?


specialagent00

Recommended Posts

Hello World,

I have a problem with our generated PDF reports:

I have an Oracle Database with EE8ISO8859P2 character set and the slovenian special characters (Ä‘špžćÄ...) are stored correctly.

PDF displays the static text fields correct (where i write special characters as unicode in the locale files) but with dynamically fields it  does not work and we only get question marks.

I have tried to set the text fields "PDF Encoding" value to couple of encodins, including ISO-8859-2, I have tried cominations of other fonts, embedding etc but still I can´t get my special characters to display correctly.

There are pretty a lot threads online but there never seems to be an answer that works for me so any help is highly appreciated.

Thanks

Link to comment
Share on other sites

  • Replies 7
  • Created
  • Last Reply

Top Posters In This Topic

Hi Theodor,

 

Thanks for the reply

 

I've tried a test report out of ireports with output as html,pdf, jasperViewer and they don´t show the characters ("?" are only in PDF, the others have square symbols).

 

Our main application where we run the reports is a delphi.exe where we create a XML parameter file and pass it to tomcat which executes the report files (thos include the select statements). sessions are being used of the delphi application which runs with ISO-8859-2

 

I have checked settings on pretty all sides (DB,delphi,tomcat,windows) to make sure i have my ISO-8859-2 anywhere but running out of ideas....

 

Thanks

 

Link to comment
Share on other sites

Hi,

 

I think the problem is not in JasperReports, but at a lower level, probably JDBC, where you read those texts from the database.

You need to make sure that once you get the text from the database, by executing the query though JDBC, you have the proper encoding set.

You should create a small application that simply reads one of those texts from the DB and displays them in an on-screen Swing dialog.

If you see them properly there, then you should continue and introduce more variables into the system, including trying to run a JR report by passing such a text value as input parameter.

 

There might be some Oracle driver related setting that would allow you control the encoding, but you might need to check the driver's documentation for that.

 

I hope this helps.
Teodor

 

Link to comment
Share on other sites

I have the same problem as the OP, and can provide more information that may help.

The program flow works like this:

 

1. Load the report.

2. Create beans to hold all the data, in a JRBeanCollectionDataSource.

3. Perform application-specific logic to determine how many copies are required. For example, one copy may be printed, another serialized to a database table, and another exported to PDF.

4. Fill each copy of the report individually. Each report will be slightly different, with minor changes to some of the static text. Some copies may have a locale override as well, translating the entire copy of the report into a separate language with different locale settings (e.g. period or comma for decimal separator).

Up until this point everything works fine. I can debug and inspect beans and variables and see that translated text is correct. At this point in the process, I have no reason to believe there are any problems.

5. Print, save, and export each JasperPrint as appropriate.

At this point, the versions printed and serialized to the database are correct (if I deserialize the DB version and print it, it shows up correctly). The PDF version has squares where non-ASCII characters are. In this case, the missing characters are accented characters in the es_MX locale (Mexican Spanish).

The font used is Lucida Sans Typewriter, which definitely contains those characters. Most fonts do, since those aren't even Unicode, they are just 8 bit characters used by most Western fonts/code pages.

I thought maybe this had to do with font embedding, but even if the font is not embedded or only has a character subset, it should display correctly on the same machine used to generate the PDF (in this case, my dev system which certainly has the correct fonts installed).

Maybe I need to specify more parameters to the export process? I noticed that CHARACTER_ENCODING is not used by the PDF engine, but TAG_LANGUAGE is. I looked at the JavaDoc and I am not sure what the contents should be (locale? code page (but Java uses UTF-16 anyway)? literal name of the language?) or if this is even used for anything besides populating something in the "properties" box in Adobe Reader.

 

Link to comment
Share on other sites

Hi Teodor,

Thx for the ideas - I also think it must be a problem with the JDBC driver, I have asked Oracle about it . However my encoding is not explicitely listet in the driver´s specification - so I will have to wait for an Oracle answer.
Probably it will be necessary to write my own converter function....

 Thanks



Post Edited by specialagent00 at 08/24/2010 11:39
Link to comment
Share on other sites

Hi,

 

John, I think your problem is different from that of the original poster.

I suggest you start a new thread on these forums and show us some JRXML and some PDF so that we understand where the problem comes from.

Actually, I would try export the report to XML using the JRXmlExporter and attach it here.

What version of JR are you using? Do you have a font extension that goes with your reports?

 

Thanks,
Teodor

 

Link to comment
Share on other sites

  • 5 years later...

Theodor,

I have a similar problem.

I work with iReport 4.0 and get data from Oracle database 11.0.2, charset ISO 8859-2.

On the iReport internal preview I see everything proper but on PDF preview I don't see polish letters.
The same when I generate report at  jasperserver.

Marek
 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...