Free Support Forum - aspose.com

Converting large html file to pdf is unresponsive


#1

We are planning to get Aspose.Total license soon and evaluating the product suite for the same.
Our Dev environment uses .net

We are trying to convert html file to image and for that the approach taken is : 1. Convert html to pdf
2. then convert pdf to image.

string Resultant_output = filename+ “.pdf”;
Aspose.Html.Rendering.Pdf.PdfRenderingOptions pdf_options =
new Aspose.Html.Rendering.Pdf.PdfRenderingOptions();

            using (Aspose.Html.Rendering.Pdf.PdfDevice pdf_device = 

new Aspose.Html.Rendering.Pdf.PdfDevice(pdf_options, Resultant_output))

            using (Aspose.Html.Rendering.HtmlRenderer renderer = new Aspose.Html.Rendering.HtmlRenderer())

            using (Aspose.Html.HTMLDocument html_document = new Aspose.Html.HTMLDocument(fStream, string.Empty))
            {
                // Render the output using HtmlRenderer
                renderer.Render(pdf_device, html_document);
            }

This approach works well for smaller size HTML. However for a large file of size approx >9MB, the code becomes unresponsive at the line : renderer.Render(pdf_device, html_document);

Can you please advise ?

Thanks


#2

@tryfileconvert19

Thank you for contacting support.

You may try HTML to Image Conversion with Aspose.HTML for .NET API and share the source file with us if you still face any problem.


#3

thanks for your response.
Had already tried the solution mentioned in the link for HTML to PNG conversion. But the image rendering code becomes unresponsive as well . probably because for large HTML file like 9MB the result out put image would also be large and images don’t split data into pages ?
Code freezes at the line: renderer.Render(img_device, html_document);


#4

@tryfileconvert19

Kindly share source file as ZIP archive. You may share it via Google Drive, Dropbox etc so that we may try to reproduce and investigate further.