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

Free Support Forum - aspose.com

Header & footer page number

Hi support,

As far as I can see, the method setIsPageNumber of the HeaderFooter object does not have any effect on the output.

Please confirm,
Milan

Hello <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />Milan,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

I have tested the issue, but I am unable to reproduce the problem. I have tested it using following code snippet.

Pdf pdf = new Pdf();
Section sec1 = pdf.getSections().add();
Text text1 = new Text(sec1,"HeaderFooter example with page number info");
HeaderFooter head = new HeaderFooter(sec1);
sec1.getParagraphs().add(text1);

sec1.setOddHeader(head);
sec1.setOddFooter(head);
head.setIsPageNumber(true);
head.getParagraphs().add(text1);

pdf.save(new FileOutputStream(new File("C:/Temp/PageBorders.pdf")));

In case if does not resolve your issue, please share your code with us, so that we can test it at our end.

Hi Nayyer,

I've tested the code from you entry, and I've attached the output. There is no page number in the header or footer. I have the jar provided by support at 19.08.2008, when you added a fix for autofit table to window : https://forum.aspose.com/t/125928 .

I didn't modify the name of the file, it remained PageBorders.pdf, as you named it.

Regards,
Milan

Hello <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />Milan,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

I have tested the issue and I’m able to reproduce the same problem, using the hotfix provided on 08-19-2008. In fact its a regression bug. Where as, setIsPageNumber is working fine in Aspose.Pdf for Java release of 06-24-2008.

I have logged it in our issue tracking system as PDFJAVA-5804. We will investigate this issue in detail and will keep you updated on the status of a correction. We apologize for your inconvenience.

Hello milan,

We have rewritten the HeaderFooter class in the hotfix I provide you. In the new hotfix, set page number is much more convenient. You get what you want via the following code:

HeaderFooter foot = new HeaderFooter(sec1);
Text text = new Text(sec1, “page $p .”);
foot.getParagraphs().add(text);
sec1.setOddFooter(foot);
sec1.setEvenFooter(foot);

To the symbol $p, you can refer to the document:
http://www.aspose.com/documentation/file-format-components/aspose.pdf-for-.net-and-java/symbols-list-and-purpose.html. But at present, only “$p, #$NL, #$TAB” are supported at present.

Thank you for using our product.


The issues you have found earlier (filed as 5804) have been fixed in this update.