We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

problem with image size and file png in HtmlConverter

hello,
I'm using an HtmlConverter (FromString method )in a web service to trasform an html string to pdf (Syncfusion version: 8.3.0.21).
visual studio 2008 and framework 3.5

The images are saved in database and loaded in html with a custom asmx handler
These are the namespaces i use in my project
Imports Syncfusion.Pdf
Imports Syncfusion.HtmlConverter
Imports Syncfusion.Pdf.Graphics
Imports Syncfusion.Pdf.Interactive
Imports Syncfusion.Pdf.HtmlToPdf
Imports Syncfusion.Compression
Imports Syncfusion.Core
and this is a fragment of my html:


New Document






test png







1.When i try to render the html with PNG's in it as a metafile no images appear.
but the png is not rendered even when not using the handler but uri such as


2.gif,jpg and jpeg often are not rendered in the correct size




8 Replies

PJ Priyadharshini J Syncfusion Team January 31, 2011 08:34 AM UTC

Hi marco,

Thank you for your interest in syncfusion products.

We are not able to reproduce the issue while html string with png, gif and jpg image in it is not properly rendered. I have placed a simple sample for the same in the location below:
Html to pdf(Html String)14949383871505149555.zip

Kindly try this and also could you please provide us the image with which the issue is reproduced. This will help us a lot in further investigation.

Please let us know if you have any queries.

Regards,
Priyadharshini.




FP fpacchia March 15, 2011 04:18 PM UTC

I have the same problem in a WebForm with HtmlConverter and the attachment shows what happen in PDF file.

Thank You
Fabrizio




test_4bde2028.zip


GM Geetha M Syncfusion Team March 16, 2011 04:58 AM UTC

Hi Fabrizio,

Thank you for the details.

HTMLConverter makes use of WebBrowser control to convert HTML to Image. The problem of image missing can occur if the webpage is converted before it is fully loaded. We have added a new property 'HtmlConverter.AdditionalDelay' so that image conversion process could wait until the HTML is fully loaded. This property is available in our latest public release v9.1.0.20.

Could you please try with this version and let us know if you still reproduce the problem?

Regards,
Geetha



FP fpacchia March 16, 2011 02:27 PM UTC

Hi Geetha,

I tried with latest public release v9.1.0.20. I putted HtmlConverter.AdditionalDelay = 5000 and the browser really wait for 5 seconds before create PDF, but the results in the PDF still remain the same.

Regards
Fabrizio




GM Geetha M Syncfusion Team March 17, 2011 07:58 AM UTC

Hi Fabrizio,

Thank you for the details.

I am afraid that I am not able to reproduce the problem. Could you please modify the below sample so that I can check and get back to you?

F98039472055379.zip

Regards,
Geetha



JQ Jean-Claude Quenaon March 18, 2011 07:42 PM UTC

Already got this problem with version 8, very hard to reproduce but existing... I waited for solution from SyncFusion, as i can see is the delay property added to the component...



FP fpacchia March 21, 2011 11:43 AM UTC

I Solved my problem!
The delay is not the solution, but the path of png image.
I added the "Server.MapPath" before the name of the page Html to convert like this:
.....
"using (HtmlToPdfResult result = html.Convert(Server.MapPath("~/test2.html"), ImageType.Metafile, (int)width, (int)height, dimension))"
.....
...

The image folder must be visible by the Html page rendered.

Regards
Fabrizio





GM Geetha M Syncfusion Team March 22, 2011 03:51 AM UTC

Hi Fabrizio,

Glad to hear that the problem is resolved.

Please let us know if you have any other questions.

Regards,
Geetha


Loader.
Live Chat Icon For mobile
Up arrow icon