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

Free Support Forum - aspose.com

Convert HTML to PDF returns an empty document

I am trying to convert a HTML document to PDF using Aspose PDF 8.7.0.0.


I am using the .NET 4.0 version of the latest version of your controls.

The code snippet is below and it produces and empty PDF document.

The attached HTML file opens in the browser but does have invalid URL’s in it for some of its resources.

Thanks in adavnce
var pdfLicense = new Aspose.Pdf.License();
        <span style="color:blue;">var</span> license = <span style="color:blue;">new</span> <span style="color:#2b91af;">License</span>();
        license.SetLicense(<span style="color:#a31515;">"Aspose.Total.lic"</span>);

        <span style="color:green;">// Instantiate license file</span>
        pdfLicense.SetLicense(<span style="color:#a31515;">"Aspose.Total.lic"</span>);
        <span style="color:green;">// Set the value to indicate that license will be embedded in the application</span>
        pdfLicense.Embedded = <span style="color:blue;">true</span>;

        <span style="color:blue;">var</span> htmlText = <span style="color:#2b91af;">File</span>.ReadAllText(parameters.SourcePath);

        Aspose.Pdf.Generator.<span style="color:#2b91af;">Pdf</span> pdf = <span style="color:blue;">new</span> Aspose.Pdf.Generator.<span style="color:#2b91af;">Pdf</span>();
        pdf.HtmlInfo.CharsetApplyingLevelOfForce = <span style="color:#2b91af;">HtmlInfo</span>.<span style="color:#2b91af;">CharsetApplyingForceLevel</span>.EnforceUseAlways;
        pdf.HtmlInfo.CharSet = <span style="color:#a31515;">"UTF-8"</span>;
        pdf.HtmlInfo.BadHtmlHandlingStrategy = <span style="color:#2b91af;">BadHtmlHandlingStrategy</span>.TreatAsPlainText;
        pdf.HtmlInfo.TryEnlargePredefinedTableColumnWidthsToAvoidWordBreaking = <span style="color:blue;">true</span>;
        pdf.HtmlInfo.ShowUnknownHtmlTagsAsText = <span style="color:blue;">true</span>;
        pdf.HtmlInfo.ShrinkLongImagesToPageHeight = <span style="color:blue;">true</span>;
        pdf.HtmlInfo.UseNewHtmlConvertorForEachHtmlTextBlock = <span style="color:blue;">true</span>;

        pdf.BindHTML(htmlText);</pre></div>

Hi Peter,


Thanks for contacting support.

I have tested the scenario and I am able to
notice the same problem. For the sake of correction, I have logged this issue
as PDFNEWNET-36131 in our issue tracking system. We will further
look into the details of this problem and will keep you updated on the status
of correction. Please be patient and spare us little time. We are sorry for
this inconvenience.

Could I please get a progress report to know if this has progressed at all?


I have a customer that is live.

Thanks in advance

Hi Peter,


<span style=“font-size:10.0pt;line-height:115%;
font-family:“Arial”,“sans-serif”;mso-fareast-font-family:“Times New Roman”;
color:#333333;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:
AR-SA”>The development team has been busy resolving other priority issues and I
am afraid the earlier reported problem is not yet resolved. Furthermore, please
note that you have reported issue under
normal/free support forum and as a normal rule of practice, issues are
resolved in first come and first serve basis; but the problems logged/reported
under Enterprise or Priority support model, have high precedence in terms of
resolution, as compare to issues under normal/free support model.
<span style=“font-size:10.0pt;line-height:115%;
font-family:“Arial”,“sans-serif”;mso-fareast-font-family:“Times New Roman”;
color:#333333;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:
AR-SA”>
<span style=“font-size:10.0pt;line-height:115%;
font-family:“Arial”,“sans-serif”;mso-fareast-font-family:“Times New Roman”;
color:#333333;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:
AR-SA”>We are sorry for this delay and inconvenience.

The issues you have found earlier (filed as PDFNEWNET-36131) have been fixed in Aspose.Pdf for .NET 9.5.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hi Peter,


Thanks for your patience. Your reported issue has been fixed in new DOM approach of HTML to PDF conversion. Please check following documentation link for details and code snippet.


Please feel free to contact us for any further assistance.

Best Regards,