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

Free Support Forum - aspose.com

Aspose.Word Html to Pdf

I am evaluating Aspose.Word C# for my company. I have some query regarding this.

I have tried to convert an input html to pdf by Aspose.Word(C#). The converted pdf is not preserving the html format.

  1. Footer is not repeating on each page.
  2. Table when extended to next page headers are not repeating.

I am attaching the input file, pdf generated via Aspose and pdf generated via browser print functionality, are there any get around for above mentioned issues??Desktop.zip (256.4 KB)


Thanks for your inquiry. Please note that Aspose.Words mimics the behavior of MS Word. If you convert your document to PDF using MS Word, you will get the same output.

With Aspose.Words you can modify the document and convert it to PDF. If you want to repeat the header of table on each page, please set the value of Row.RowFormat.HeadingFormat property as true.

I am setting the value of Row.RowFormat.HeadingFormat property as true. Below is my code , input file is HTML
Document doc = new Document(templatePath, objLoadOptions);
Table table = (Table)doc.GetChild(NodeType.Table, 0, true);
table = (Table)doc.GetChild(NodeType.Table, 4, true);

        Row firstRow = table.FirstRow;
        firstRow.RowFormat.AllowBreakAcrossPages = false;
        firstRow.RowFormat.HeadingFormat = true;

doc.Save(outPutPath, Aspose.Words.SaveFormat.Pdf);
Still header is not repeated on page break.


Thanks for your inquiry. As shared in my previous post, Aspose.Words mimics the behavior of MS Word. Your HTML document has one main table that contains the nested tables in each cell. When the table is inside another table’s cell and RowFormat.HeadingFormat property is set, the header row of nested table does not repeat on each page break. Please do not use the nested table in your input document to get the desired behavior.