Page 1 of 3

The problem of export pdf

Posted: Mon Mar 14, 2016 6:35 am
by heqichao
hi stimulsoft;
I use the next java code to export pdf file , but it isnt working, the size of this pdf file is zero , I cannt open this pdf file , how to modify the code ?
Image, thanks

Re: The problem of export pdf

Posted: Mon Mar 14, 2016 7:17 am
by Vadim
Hello.
You deserialize report template, but not run render, therefore report is empty.
Please add

Code: Select all

stiReport.render();
before export.

Re: The problem of export pdf

Posted: Mon Mar 14, 2016 7:27 am
by heqichao
thanks ,but how to fix Chinese messy code ?

Re: The problem of export pdf

Posted: Mon Mar 14, 2016 9:39 am
by Vadim
Hello.
Can you explain your problem in more detail, maybe with pictures?

Re: The problem of export pdf

Posted: Mon Mar 14, 2016 11:28 am
by heqichao
I use a demo such as
Image ,
and on html preview is
Image,
but export pdf file is
Image
thanks

Re: The problem of export pdf

Posted: Mon Mar 14, 2016 11:51 am
by Vadim
Hello.
You must use font wich include Chinese symbols (for example Arial Unicode)
Browsers use system Fallback font functions (https://en.wikipedia.org/wiki/Fallback_font) to display symbols from other fonts, but PDF can't use it.

Re: The problem of export pdf

Posted: Tue Mar 15, 2016 12:56 am
by heqichao
Hello.
How can I use font wich include Chinese symbols on java code? and can you give me an API?

Re: The problem of export pdf

Posted: Tue Mar 15, 2016 6:14 am
by Vadim
Hello.
You must setup font for each components you need. For example in our system font "Arial Unicode MS" include Chinese symbols, by designer or by code:

Code: Select all

((StiText) report.GetComponentByName("Text1")).setFont(new StiFont("Arial Unicode MS", 8));
Or you can replace font name in .mrt file in text editor.

Re: The problem of export pdf

Posted: Tue Mar 15, 2016 7:05 am
by heqichao
Thank you ,it is working.
But it can be tedious to maintain because it imposes a duplication of code, I must setup the font on the .jsp and the java code on exporting to PDF file

Re: The problem of export pdf

Posted: Tue Mar 15, 2016 7:09 am
by heqichao
It also too difficulty to set a variety of fonts on the report