Html table is getting cut

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)

@kandari7

Could you please ZIP and attach your input HTML and PDF here for testing? We will investigate the issue and provide you more information on it.

Hi Tahir, please find the HTML and output (in PDF) attached.

Aspose.zip (234.0 KB)

@kandari7

We suggest you please use following code example to avoid the shared issue.

HtmlLoadOptions options = new HtmlLoadOptions();

options.PageInfo.Margin = new MarginInfo(20, 20, 20, 20);

Document doc = new Document(MyDir + "Form A.html", options);
doc.Save(MyDir + "output.pdf");

Hi Tahir,

as per your code, new Document() accept html file path, however, in our code we are modifying our HTML file and want to pass the html text.

@kandari7

You are setting the page size explicitly. Please remove these lines of code to get the desired output.

You are passing the HTML stream into Document. You can use file path or stream of file to Document. In both cases, the output will be same.

If your requirement is different, please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.