I am trying to convert HTML to pdf but the PDF is cutting the data on the right side. The same code was working fine with old version i.e., V15, I recently updated the aspose.pdf to V22.7.0.0 and now facing formatting issue , please find the code below:
body = get html text;
MemoryStream stream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(body));
string basePath = "c:/"
Aspose.Pdf.HtmlLoadOptions options = new Aspose.Pdf.HtmlLoadOptions(basePath);
Aspose.Pdf.License asposeLic = new Aspose.Pdf.License();
asposeLic
options.PageInfo.Margin = new MarginInfo(20, 20, 20, 20);
options.PageInfo.Height = Aspose.Pdf.PageSize.A4.Height;
options.PageInfo.Width = Aspose.Pdf.PageSize.A4.Width;
options.PageInfo.IsLandscape = true;
Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(stream, options);
pdfDocument.PageInfo.Width = 800;
string path = basePath + DateTime.Now.ToString("ddMMyyyyhhmmss") + "_" + empId + ".pdf";
pdfDocument.Save(path);
Response.ContentType = ContentType;
Response.AppendHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(path));
Response.WriteFile(path);
Response.End();
image.png (14.8 KB)