on 04-09-2009 4:00 AM
Dear all,
I am facing with the problem when i used CR4E vs 2.0 to design crystal report and used JRC to show report. I key-in on report with unicode font to display the VietNamese language. When i exported my report to PDF file then characters can't display right. Some characters change to "?" symbol.
The font i use when key-in the character is Arial.
Please help me to solve this problem or explain for me to got others way.
Thank you so much
Tuan Pham
The "?" indicates it's a character encoding issue, and not a Font issue.
Does the issue happen only with PDF, or with all output formats?
What is the datasource character encoding?
Sincerely,
Ted Ueda
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Ted Ueda,
The issue posted only with PDF format file when exported. I used to POJO datasource.
I tried to converting method from native2ascii to encoding UTF-8 string. The string is displayed on report when runtime is fine. But when i export to PDF format file is the issue posted.
Best Regards,
Tuan Pham
Dear Ted Ueda,
The "?" is appeared when i use "ሴ" on report. I think its not the problem at there.
a) The stream i want to display on report in VietNammese is "Công ty Bảo hiểm Hàn Quốc".
b) The stream is converted with UTF8-encoding is "C\u00f4ng ty Bảo hiểm H\u00e0n Quốc".
c) The stream is display on reported at the run-time is "Công ty B?o hi?m Hàn Qu?c".
You see the different bwt the stream a) and c). I hope you can find this problem and help me solve it.
Thank you for your information.
Best Regards,
Tuan Pham
I need to know the Unicode encoding so I can try an reproduce the issue.
By the way, the ሴ isn't UTF-8, it's Java String Unicode escape sequence.
I placed the String "C\u00f4ng ty Bảo hiểm H\u00e0n Quốc" and it exports to PDF with String "Công ty Bảo hiểm H..." just fine. Note that I'm using CR4E2.0 Service Pack 1 - download is the first post in this forum.
If Service Pack 1 doesn't resolve, then the missing characters (i.e., ô is ok but ả is not) indicates something transformed to ANSI character encoding from Unicode.
Another thing - if you look at the Document Properties in Adobe Reader and look up Fonts, does it indicate ANSI encoding? CR4E2.0 doesn't use character encoding, since it subsets (embeds) the font glyphs. Previous versions use ANSI encoding for PDF export.
Sincerely,
Ted Ueda
Dear Ted Ueda,
I'm using Crystal Reports for Eclipse Version: 2.0.1.r566 (Service Pack 1) i have just updated from site through Sofware Updates menu from Eclipse editor.
I tried to do some advances from you. I have seen that:
a) " Document Properties in Adobe Reader, look up Fonts is ok but encoding is ANSI".
b) When i replace the string UTF8 encoding with orginal Vietnames string and export to PDF file the issue still posted.
I think the coding should be change when we export to PDF. Some main coding to export PDF below, could you please checking the issue?
[[[
//Export report and obtain an input stream that can be written to disk.
//See the Java Reporting Component Developer's Guide for more information on the supported export format enumerations
//possible with the JRC.
ByteArrayInputStream byteArrayInputStream = (ByteArrayInputStream)reportClientDoc.getPrintOutputController().export(ReportExportFormat.PDF);
//Release report.
reportClientDoc.close();
//Use the Java I/O libraries to write the exported content to the file system.
byte byteArray[] = new byte[byteArrayInputStream.available()];
//Create a new file that will contain the exported result.
File file = new File(EXPORT_FILE);
FileOutputStream fileOutputStream = new FileOutputStream(file);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(byteArrayInputStream.available());
int x = byteArrayInputStream.read(byteArray, 0, byteArrayInputStream.available());
byteArrayOutputStream.write(byteArray, 0, x);
byteArrayOutputStream.writeTo(fileOutputStream);
//Close streams.
byteArrayInputStream.close();
byteArrayOutputStream.close();
fileOutputStream.close();
System.out.println("Successfully exported report to " + EXPORT_FILE);
]]]
Thank you for your advances
Best Regards,
Tuan Pham
Dear Ted Ueda,
I'm using Crystal Reports for Eclipse Version: 2.0.1.r566 (Service Pack 1) i have just updated from site through Sofware Updates menu from Eclipse editor.
I tried to do some advances from you. I have seen that:
a) " Document Properties in Adobe Reader, look up Fonts is ok but encoding is ANSI".
b) When i replace the string UTF8 encoding with orginal Vietnames string and export to PDF file the issue still posted.
I think the coding should be change when we export to PDF. Some main coding to export PDF below, could you please checking the issue?
[[[
//Export report and obtain an input stream that can be written to disk.
//See the Java Reporting Component Developer's Guide for more information on the supported export format enumerations
//possible with the JRC.
ByteArrayInputStream byteArrayInputStream = (ByteArrayInputStream)reportClientDoc.getPrintOutputController().export(ReportExportFormat.PDF);
//Release report.
reportClientDoc.close();
ByteArrayInputStream is = new ByteArrayInputStream(Charset.forName("UTF-16").encode(byteArrayInputStream.toString()).array());
writeToFileSystem(is, EXPORT_OUTPUT);
//Use the Java I/O libraries to write the exported content to the file system.
byte byteArray[] = new byte[byteArrayInputStream.available()];
//Create a new file that will contain the exported result.
File file = new File(EXPORT_FILE);
FileOutputStream fileOutputStream = new FileOutputStream(file);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(byteArrayInputStream.available());
int x = byteArrayInputStream.read(byteArray, 0, byteArrayInputStream.available());
byteArrayOutputStream.write(byteArray, 0, x);
byteArrayOutputStream.writeTo(fileOutputStream);
//Close streams.
byteArrayInputStream.close();
byteArrayOutputStream.close();
fileOutputStream.close();
System.out.println("Successfully exported report to " + EXPORT_FILE);
]]]
This one using for Persian language purpose but whenever export pdf format error showing need solution ??????????
Hi Ted,
We are using crystal report viewer 11. While exporting crystal report pdf for persian language we are facing an issue, the characters are displaying wrongly ????. Even we are using persian rpt file.
In viewer it is displaying properly. But while exporting PDF it shows wrongly ???.
Kindly help us to fix the issue ASAP.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.