Hi,
When we are converting HTML to PDF we notice extra line breaks in converted PDF. When we open HTML is MS word we don’t get extra line breaks.
Below is the code which we are using
using (var memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(File.ReadAllText(@“C:\Users\msingh02\Desktop\IssueFile.html”))))
{
Aspose.Words.Document docw = new Aspose.Words.Document(memoryStream, new LoadOptions(LoadFormat.Html, null, null));
foreach (Aspose.Words.Section sec in docw.Sections)
{
Aspose.Words.PageSetup ps = sec.PageSetup;
// 1 inch equals 72 points
ps.TopMargin = 0;
ps.RightMargin = 0;
ps.BottomMargin = 0;
ps.LeftMargin = 0;
ps.PageWidth = Aspose.Pdf.Generator.PageSize.A4Width;
ps.PageHeight = Aspose.Pdf.Generator.PageSize.A4Height;
}
docw.Save(“d:\outputInk6New2.pdf”);
Please find html file as attachment.Aspose Line break issue.zip (287.4 KB)
Thanks,
Mukesh Singh