Odd HTML to PDF Conversion Behavior

I’m attempting to convert the attached HTML to a formatted for print PDF. When using the following code it creates the attached PDF which looks far from the HTML in any browser and also is making the PDF interactive (allowing dropdowns, etc) rather than just showing the already selected values for print. This is against Aspose.PDF v11.3. Looking at the listing of currently unsupported HTML items I don’t see any being used that would be causing such a drastic conversion result.



// Instantiate HTML Load options object

Aspose.Pdf.HtmlLoadOptions loadOptions = new Aspose.Pdf.HtmlLoadOptions();



// Load source PDF file

Document doc = new Document(@“C:\SOURCE.HTML”, loadOptions);



// Save output as PDF format

doc.Save(@“C:\HTMLtoPDF.pdf”);

Hi Troy,

Thanks for contacting support.

I have tested the scenario of HTML to PDF conversion and have observed that form fields appear in resultant PDF file. In fact its the required behavior to render HTML form fields inside PDF file. However I have observed that formatting of resultant file is not good as input / resource HTML. For the sake of correction, I have logged it as PDFNET-41117 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.

Meanwhile if you need to display the form fields as labels, try using Flatten(…) method of Document object. For your reference, I have also attached the output generated over my end.

[C#]

// Instantiate HTML Load options object
Aspose.Pdf.HtmlLoadOptions loadOptions = new Aspose.Pdf.HtmlLoadOptions();

// Load source PDF file
Document doc = new Document(@"C:\pdftest\Source.html", loadOptions);
doc.Flatten();

// Save output as PDF format
doc.Save(@"C:\pdftest\Source_HTMLtoPDF.pdf");

Thanks Nayyer. Your suggestion to use Flatten did display only the field values which was one of the hurdles we had during conversion. Do you have any update or ETA on getting the rest of the HTML to render appropriately?

Hi Troy,


Thanks for your patience.

As we recently have noticed earlier reported issue, so its pending for review and is not yet resolved. However the product team will surely consider investigating/fixing it as per development schedule and as soon as we have some definite updates regarding its resolution, we will let you know. Please be patient and spare us little time. We are sorry for this delay and inconvenience.