Free Support Forum - aspose.com

Html to PDF Incorrect rendition

Hi,
I am using Aspose PDF for converting an html to pdf file, but the rendition is incorrect. It add undesired borders to PDF rendition for “Original_file.htm” , Please refer to attached sample html file and PDF rendition

For instance, the header section has borders on the following lines:

BUYER’S NAME:
BUYER’S PHONE NUMBER:
BUYER’S ADDRESS:
DESCRIPTION OF WIRELESS COMMUNICATIONS DEVICE:
INSTALLMENT ID:

Attaching the input and the rendition for the same.

input_rendition.zip (208.6 KB)

Regards,
Ankur Vashishtha

@AjeshEMC

Thanks for contacting support.

We have checked the data shared by you and found that above header in the HTML contains fields (TextBoxes) instead of plain text which is why, the output PDF file displays content with border. They are not plain text but text boxes/form fields. In you have further inquiry, please feel free to let us know.

Is there any way we can render it as a plain text to PDF, irrespective of the text boxes /form fields?

Regards,
Ankur Vashishtha

@AjeshEMC

Thanks for getting back to us.

You can flatten form fields after generating PDF using following code snippet. This way the text would not be editable.

Aspose.Pdf.Document doc = new Aspose.Pdf.Document(dataDir + "htmls.pdf");
var fields = doc.Form.Fields;
foreach (var f in fields)
{
  f.Flatten();
}
doc.Save(dataDir + @"htmls_flattened.pdf"); 

In case you still face any issue or have any other inquiry, please feel free to let us know.