The problem of export pdf

Stimulsoft Reports.JAVA discussion
heqichao
Posts: 113
Joined: Fri Mar 04, 2016 9:02 am

The problem of export pdf

Post 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
Vadim
Posts: 363
Joined: Tue Apr 23, 2013 11:23 am

Re: The problem of export pdf

Post by Vadim »

Hello.
You deserialize report template, but not run render, therefore report is empty.
Please add

Code: Select all

stiReport.render();
before export.
heqichao
Posts: 113
Joined: Fri Mar 04, 2016 9:02 am

Re: The problem of export pdf

Post by heqichao »

thanks ,but how to fix Chinese messy code ?
Vadim
Posts: 363
Joined: Tue Apr 23, 2013 11:23 am

Re: The problem of export pdf

Post by Vadim »

Hello.
Can you explain your problem in more detail, maybe with pictures?
heqichao
Posts: 113
Joined: Fri Mar 04, 2016 9:02 am

Re: The problem of export pdf

Post by heqichao »

I use a demo such as
Image ,
and on html preview is
Image,
but export pdf file is
Image
thanks
Vadim
Posts: 363
Joined: Tue Apr 23, 2013 11:23 am

Re: The problem of export pdf

Post 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.
heqichao
Posts: 113
Joined: Fri Mar 04, 2016 9:02 am

Re: The problem of export pdf

Post by heqichao »

Hello.
How can I use font wich include Chinese symbols on java code? and can you give me an API?
Vadim
Posts: 363
Joined: Tue Apr 23, 2013 11:23 am

Re: The problem of export pdf

Post 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.
heqichao
Posts: 113
Joined: Fri Mar 04, 2016 9:02 am

Re: The problem of export pdf

Post 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
heqichao
Posts: 113
Joined: Fri Mar 04, 2016 9:02 am

Re: The problem of export pdf

Post by heqichao »

It also too difficulty to set a variety of fonts on the report
Post Reply