Image not showing when Export to pdf from Code

Stimulsoft Reports.JS discussion
sorinav
Posts: 21
Joined: Mon Jul 31, 2017 5:13 pm

Image not showing when Export to pdf from Code

Post by sorinav »

Hello!

I am using "Samples-NET.Core-CSharp-master" sample code project "Export-Report-from-Code"
The invoice report I am creating with this sample has some errors:

- the pdf file doesn't have the logo
- line spacing is less that normal(too close)

(see attachment)

NOTE: these problems are only when I export to pdf from code (when open the report in the viewer then export from there is ok)

Any ideas, suggestions...
I am trying to make a decision to purchase this component and these problems are holding me back.

Thank you
Attachments
V95852.pdf
(29.17 KiB) Downloaded 339 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Image not showing when Export to pdf from Code

Post by HighAley »

Hello.

What code do you use to export the report?
Do you get image from the same domain?
Could you send us a sample that will help us to reproduce the issue?

Thank you.
sorinav
Posts: 21
Joined: Mon Jul 31, 2017 5:13 pm

Re: Image not showing when Export to pdf from Code

Post by sorinav »

Hi,

The attached project will not reproduce the behavior.
Thank you very much!
Attachments
WebApplication1.zip
(4.97 MiB) Downloaded 194 times
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

Re: Image not showing when Export to pdf from Code

Post by Ivan »

Hello,
sorinav wrote:- the pdf file doesn't have the logo
NodeJS has some limitations and at this moment only images in jpeg format correctly exported to the pdf-file.
So please try to use the logo image in jpeg format.

Thank you.
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Re: Image not showing when Export to pdf from Code

Post by Edward »

Hi Sorinav,

As for the second part of the question about the issue with the font spacing.
The MeasureString method that is used for the report rendering, has been done with help of the visual components. Node.js does not have these components at all. So all the measurements are done using the openType library.
Node.js does not support any kind of fonts out of the box.
So you need to load all the fonts that are used by the report with help of the following method:

Code: Select all

Stimulsoft.Base.StiFontCollection.addOpentypeFontFile("arial.ttf");
So if one of the report fonts had not been loaded - the report export result would be different as it is clear from your sample project.
So the solution here - is to load all the fonts that the report template is using with help of the above code.

The above mentioned code will help to render the report's fonts in all the environments that are supported, i.e. Mac, Linux, Android & Windows, because the library will process each font as a byte array.

Thank you,
Edward
sorinav
Posts: 21
Joined: Mon Jul 31, 2017 5:13 pm

Re: Image not showing when Export to pdf from Code

Post by sorinav »

Hi Ivan,

Thank you very much for the tip, Using jpg images solve the problem.
sorinav
Posts: 21
Joined: Mon Jul 31, 2017 5:13 pm

Re: Image not showing when Export to pdf from Code

Post by sorinav »

Hi Edward,

Thank you for the explanations. I will try to load the font as you said. Thank you again!
sorinav
Posts: 21
Joined: Mon Jul 31, 2017 5:13 pm

Re: Image not showing when Export to pdf from Code

Post by sorinav »

Hi Edward,

The font is loaded but line space remains remains at the same value. Is there any global method to increase or set the line space value? Thank you very much.

Sorin
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Image not showing when Export to pdf from Code

Post by HighAley »

Hello.

Could you send us your current sample project?
We will answer after analysis of your project.

Thank you.
sorinav
Posts: 21
Joined: Mon Jul 31, 2017 5:13 pm

Re: Image not showing when Export to pdf from Code

Post by sorinav »

Hi, Attached is the project I use.
Thank you very much.
Attachments
WebApplication1.zip
(6.38 MiB) Downloaded 312 times
Post Reply