on 10-16-2009 6:27 PM
Hi.
I have a trouble while exporting Crystal Report with Russian or Lithuanian characters to pdf on web.
Example given by Mr Thomas Kron does not work.
Discribe by steps what should be done to make PDF exported in Russian letters.
Thanks.
Any ideas???
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Question marks mean one of the following:
1. You're using an older CR4E engine - not 2.0
2. You've defined a font unavailable to the Java Runtime, so it's substituting with a default font that is not embeddable. So it uses indexed fonts with ANSI encoding, that does not encompass Eastern European language sets.
3. You've explicitly defined use of a non-embeddable font.
Sincerely,
Ted Ueda
Hello)
My code.
<%@page pageEncoding="UTF-8" import="com.businessobjects.samples.JRCHelperSample,
com.crystaldecisions.reports.sdk.ReportClientDocument,
com.crystaldecisions.sdk.occa.report.application.OpenReportOptions,
com.crystaldecisions.sdk.occa.report.lib.ReportSDKExceptionBase,
com.crystaldecisions.sdk.occa.report.reportsource.IReportSource, java.io., com.crystaldecisions.sdk.occa.report.exportoptions.ReportExportFormat, com.lowagie.text., com.lowagie.text.pdf.*"%><%
// This sample code calls methods from the JRCHelperSample class, which
// contains examples of how to use the BusinessObjects APIs. You are free to
// modify and distribute the source code contained in the JRCHelperSample class.
try {
BaseFont baseFont = BaseFont.createFont("C:/windows/fonts/Liberation Sans.ttf",
BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
Font font = new Font(baseFont, Font.DEFAULTSIZE,Font.NORMAL);
String incomingRPT = "CrystalReport1.rpt";
String outgoingPDF = "outgoing.pdf";
ReportClientDocument reportClientDoc = new ReportClientDocument();
reportClientDoc.open(incomingRPT, 0);
ByteArrayInputStream byteArrayInputStream = (ByteArrayInputStream)reportClientDoc.getPrintOutputController().export(ReportExportFormat.PDF);
reportClientDoc.close();
byte byteArray[] = new byte[byteArrayInputStream.available()];
File file = new File(outgoingPDF);
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);
byteArrayInputStream.close();
byteArrayOutputStream.close();
fileOutputStream.close();
DataOutput output = new DataOutputStream( response.getOutputStream() );
for( int i = 0; i < byteArray.length; i++ ) {
//byte b = -128;
//To Char
//char c = (char)(b & 0xFF);
//To Byte
//byte b2 = (byte)(c & 0xFF);
//byte b = -128;
//char c = (char)b;
//System.out.println(c);
//char c2 = (char)(b + 128);
//System.out.println(c2);
//byte b2 = (byte)(c2 -128);
output.writeByte( byteArray<i> );
}
} catch (ReportSDKExceptionBase e) {
out.println(e);
}
%>
-
This exmaple don't work.
byte b = byteArray<i>;
char c = (char)(b & 0xFF);
String str = Character.toString(c);
byte h[] = str.getBytes("cp1251");
System.out.print((char)(byteArray<i> & 0xFF));
byteArrayOutputStream.
output.writeByte(h[0]);
All character is invisible.
How to make RUSSIAN CHARACTER in PDF???
Hi.
For the development purpose I have downloaded u201CAll-In-Oneu201D Eclipse installation (u201CEclipse Ganymede 3.4.0 with Crystal Reports for Eclipseu201D) from businessobjects.com (Crystal Reports for Eclipse version is 2.0.2.r678). Server: Tomcat 6.0
Export to RTF or CSV to works fine.
Export to pdf on web to works bad. Russian character are exported as question marks u201C?u201D, but digit are not exported as questions marks)
1)I made/exported the document into PDF
2)File - Document Properties - Fonts - Type: TrueType; Encoding : ANSI.
I should have code UTF-8 for correct PDF work? What should be done for code to be UTF-8?
Thanks)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ensure you're using Crystal Reports for Eclipse 2.0
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.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.