Converting HTML to PDF (Formatting issues)

var hlo = new HtmlLoadOptions
{
PageInfo = new PageInfo
{
Width = PageSize.A3.Width,
Height = PageSize.A3.Height,
Margin = new MarginInfo
{
Bottom = 40,
Top = 80,
Left = 20,
Right = 20
}
}
};
return new Document(new MemoryStream(Encoding.UTF8.GetBytes(htmlBody)), hlo)

PDF format is different compared with HTML.
Tried A4,lettersize and A3(A4 and letter size-Images are getting cropped)

The format is completely left aligned
FYI: HTML has images on the right side.
We tried using 20.7 and 20.10 latest version and still it’s the same.
Could you please advise

@telltouday

Would you please share your sample HTML file in .zip format with us. We will test the scenario in our environment and address it accordingly.

9.zip (3.1 MB)
Please see the attached HTML file with images.
FYI:If we use print to pdf from browser the format is good.

@telltouday

We used following code snippet with Aspose.PDF for .NET 20.10 and obtained attached output.

HtmlLoadOptions objLoadOptions = new HtmlLoadOptions(dataDir);
objLoadOptions.PageInfo.Margin = new MarginInfo(20, 40, 20, 80);
objLoadOptions.PageInfo.Width = PageSize.A3.Width;
objLoadOptions.PageInfo.Height = PageSize.A3.Height;
Aspose.Pdf.Document doc = new Aspose.Pdf.Document(dataDir + "1.html", objLoadOptions);
doc.Save(dataDir + "htmltopdf.pdf");

htmltopdf.pdf (1.1 MB)

We noticed some unwanted symbols in the generated output PDF. Would you please check it and highlight what other issues do you notice? We will further proceed to assist you accordingly.

Thank you. I figured out the issue and can able to convert the report format properly.

@telltouday

It is nice to know that your issue has been resolved now. Please keep using our API and in case you face any issue, please feel free to let us know.

REQ-4475_Form.zip (2.9 KB)

Facing issue:
com.aspose.pdf.internal.l20if.l12if: Requested font type subsetting is not supported.

while converting attached html to pdf.
Your help is required. We are using aspose.pdf.17.2 jar