Hi Team,
We’re facing a dimension issues with HTML conversion in which the widths of the content were being rendered different from the browser and it’s not expected. I’m posting the HTML attachment we’re using and the result from Aspose also the formatted pdf which we need.
PFA: Aspose Issue.zip (108.9 KB)
Please expedite this as we’re facing this issue in production environment.
Thanks,
Shanthi Kumar
@Shanthi555k,
Thanks for your inquiry. Please note that Aspose.Words mimics the same behavior as MS Word does. If you convert your HTML to PDF using MS Word, you will get the same output.
Hi,
We tried by using Aspose.Pdf also for the Html to pdf conversion the output which we get is looking even poor.
Please find the attached output from the Aspose.Pdf. outputH.pdf (62.6 KB)
You can even suggest us any html changes or workarounds to get the correct out as we get in browser.
Thanks,
Mukesh Singh
please suggest how we can get same pdf output as we get for html in Browser.
Hi,
Even we tried with possible settings to overcome the layout but didn’t achieve what we need.? Can you somehow assist with any HTML modifications or the one which breaking the layout while PDF conversion.
Thanks
Shanthi Kumar
@Shanthi555k,
Thanks for your inquiry. We have logged this problem in our issue tracking system as WORDSNET-16054. Our product team will look into this issue and you will be notified via this forum thread once there is any update available on this issue.
We apologize for your inconvenience.
@Shanthi555k
Thank you for being patient.
We have worked over your requirements and I would like to share with you that Aspose offers an advanced HTML manipulation API. Aspose.Html for .NET enables you to perform a wide range of HTML manipulation tasks.
Please try using below code snippet with Aspose.Html for .NET 17.12 in your environment, and you will notice the generated PDF document is rendered fine, exactly the same as you see it with HTML in a browser. I have attached the generated PDF file for your kind reference. report_example_Converted.pdf
// Create PdfRendering Options object
Aspose.Html.Rendering.Pdf.PdfRenderingOptions pdf_options = new Aspose.Html.Rendering.Pdf.PdfRenderingOptions();
// Instantiate PdfDevice object while passing PdfRenderingOptions and resultant file path as arguments
using (Aspose.Html.Rendering.Pdf.PdfDevice pdf_device = new Aspose.Html.Rendering.Pdf.PdfDevice(pdf_options, @"D:\Aspose Files\report_example_Converted.pdf"))
// Create HtmlRenderer object
using (Aspose.Html.Rendering.HtmlRenderer renderer = new Aspose.Html.Rendering.HtmlRenderer())
// Create HtmlDocument instance while passing path of already created HTML file
using (Aspose.Html.HTMLDocument html_document = new Aspose.Html.HTMLDocument(@"D:\Aspose Files\report_example.htm"))
{
// Render the output using HtmlRenderer
renderer.Render(pdf_device, html_document);
}
I hope this will be helpful. Please let us know if you need any further assistance.