We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Issues in Converting from HTML to PDF

pdf.zip (9.3 KB)
pdf.png (82.3 KB)

I am trying to convert the HTML string to PDF using aspose pdf. But the generated PDF is having below issues which i have highlighted in the “pdf.png” file. Also i have zipped my HTML file and attached.

  1. Text Overlapping
  2. Text cropping
  3. Eventhough we have more data, it is truncating the data and not generating full data.

please help me in resolving this issues.

thanks & regards,


I would like to share with you that the source HTML file shared by you is not being displayed correctly because of some dependencies including the CSS file. I have attached the screenshot for your kind reference capture.png. Please share the sample code, generated PDF file and the HTML source file reproducing the issue so that we may investigate it further to help you out.

New folder.zip (130.3 KB)

Hi Team,

I am attaching the sample code , html string and generated PDF file.
you dont require css files as it is embeded in the html file(if you run the html it will show with styles… use different browser if not rendered properly).
in the below sample code… you can replace “stringWriter.ToString()” with html string shared.
MemoryStream stream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(stringWriter.ToString()));

Thanks & Regards,


I am afraid the css file may not be embedded in the HTML file. I have attached the screenshots of different web browsers for your kind reference. If you check the source of this HTML file, you will notice its referencing to 2 css files, base-style.css and handover-style.css which are present in D drive on your local disk. Kindly share the css file(s) so that we may proceed further to help you out.

Chrome.JPG (41.5 KB)
Edge.JPG (37.1 KB)
Internet Explorer.JPG (38.9 KB)

CSS Files.zip (4.3 KB)

Hi Team,

Please find the CSS files.



Thanks for sharing CSS file(s).

We have tested the scenario in our environment and observed the issues, which you have mentioned. We have logged these issues under the ticket ID PDFNET-43698, in our issue tracking system. We will further investigate the issue and keep you posted with the status of its correction.

Furthermore, the issue was occurring, because width of HTML content was more than it was in the generated PDF. So if we set page width in the PDF, being generated, the correct output can be obtained. Please use following code snippet as a workaround, to generate correct output.

// dataDir is the path where CSS files are located
var loadoptions = new HtmlLoadOptions(dataDir);
loadoptions.PageInfo.IsLandscape = true;
loadoptions.PageInfo.Margin = new MarginInfo(10, 10, 10, 10);
loadoptions.PageInfo.Width = 30 * 72; // 30 inches
Document doc = new Document(dataDir + "pdf.html", loadoptions);
doc.Save(dataDir + "pdf_out.pdf");

For your reference, we have attached an output PDF document as well, which was generated by above code snippet.

pdf_out.pdf (186.7 KB)

We are sorry for the inconvenience.

Thank you team for the work around. I am attaching the new html file which has following extra components in it compared to last shared html file.

  1. PDF file embedded in the html string.
  2. High charts also there.

Could you please use this html as i need to convert the html (with charts & pdfs inside the html) to PDF because while converting it is throwing ‘Out of memory exception’ and charts are not displaying in the PDF.New Html.zip (9.9 KB)

Thanks & Regards,


Thanks for writing back.

We have checked the HTML file which you have shared but were unable to notice any chart inside it. loading_issue.png (4.3 KB) It seems that charts need some JavaScript file(s), which are referenced as well in the head tag of HTML file. We will really appreciate if you can please share JavaScript file(s), necessary to load charts and other objects in the HTML.

We will test the scenario in our environment and address it accordingly.