Converting HTML with page number

I’m converting a long html page to doc file.

Since the html page is quite long, the doc file has multiple pages.

With this, I just wonder if it’s possible to put a page number on each page of the doc file.

Thanks.

Hi Changro,

Thanks for your inquiry. Please move the cursor to the header of document and insert the page number field as shown in following code example. Hope this helps you. Please let us know if you have any more queries.

Document doc = new Document(MyDir + "in.htm");
DocumentBuilder builder = new DocumentBuilder(doc);
builder.moveToHeaderFooter(HeaderFooterType.HEADER_PRIMARY);
builder.write("Page Number : ");
builder.insertField(FieldType.FIELD_PAGE, true);
doc.save(MyDir + "Out.docx");