Page 1 of 2
Image not showing when Export to pdf from Code
Posted: Wed Aug 09, 2017 2:49 pm
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
Re: Image not showing when Export to pdf from Code
Posted: Fri Aug 11, 2017 12:29 pm
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.
Re: Image not showing when Export to pdf from Code
Posted: Mon Aug 21, 2017 5:59 pm
by sorinav
Hi,
The attached project will not reproduce the behavior.
Thank you very much!
Re: Image not showing when Export to pdf from Code
Posted: Fri Aug 25, 2017 12:14 am
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.
Re: Image not showing when Export to pdf from Code
Posted: Fri Aug 25, 2017 12:50 am
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
Re: Image not showing when Export to pdf from Code
Posted: Tue Aug 29, 2017 8:58 pm
by sorinav
Hi Ivan,
Thank you very much for the tip, Using jpg images solve the problem.
Re: Image not showing when Export to pdf from Code
Posted: Tue Aug 29, 2017 9:04 pm
by sorinav
Hi Edward,
Thank you for the explanations. I will try to load the font as you said. Thank you again!
Re: Image not showing when Export to pdf from Code
Posted: Wed Aug 30, 2017 7:11 am
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
Re: Image not showing when Export to pdf from Code
Posted: Tue Sep 05, 2017 7:28 pm
by HighAley
Hello.
Could you send us your current sample project?
We will answer after analysis of your project.
Thank you.
Re: Image not showing when Export to pdf from Code
Posted: Wed Sep 06, 2017 2:31 pm
by sorinav
Hi, Attached is the project I use.
Thank you very much.