We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Formatting breaks while converting html to pdf

Hello,

I have used following code to convert html file into pdf format (pfa - Linebreakdocument (3).zip (187.0 KB)

and it breaks the formatting of vertical lines. See the screenshot - Screenshot 2022-07-20 211843.png (63.4 KB)

Console app -

using System;
using System.Drawing;
using System.IO;
using Aspose.Pdf;

namespace ExtraSpaceInHtmlToPdf
{
    class Program
    {
        static void Main()
        {
            try
            {
                string dataDir = @"C:\AsposeTesting";

                // Prepare a path to a source HTML file
                string documentPath = Path.Combine(dataDir, "LineBreak.html");

                // Prepare a path for converted file saving 
                string savePath = Path.Combine(dataDir, "Linebreakdocument.pdf");

                HtmlLoadOptions htmlOptions = new HtmlLoadOptions();
                htmlOptions.PageInfo = new PageInfo() { Margin = new MarginInfo(0, 10, 0, 20) };
                Document pdfDocument = new Document(documentPath, htmlOptions);
                SaveOptions saveOptions = new PdfSaveOptions();
                pdfDocument.Save(savePath, saveOptions);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Issue with Aspose!! " + ex.Message);
            }
        }
    }
}

I have tried workaround using
htmlOptions.IsRenderToSinglePage = true;
but the problem is It renders everything into single page and I need all the pages (for example 5 in the attached file) to print.
Please share any other workaround or solution.

Regards,
Sumit Awasthi

@sumitworksimpli

We were able to replicate the issue in our environment while using 22.7 version of the API. Therefore, it has been logged as PDFNET-52133 in our issue tracking system. We will further look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.