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

Free Support Forum - aspose.com

Page numbers are not showing in footer - PDF

Hi,

Issue here is:
When I convert document from HTML to PDF (using download option), page numbers are not showing.


I don’t create page numbers in footer, just converting from HTML to PDF.

Html for footer is:

1

 



Code for converting HTML to PDF:
<pre style=“background-color: rgb(255, 255, 255); font-family: “Courier New”; font-size: 9pt;”>input = new ByteArrayInputStream(documentDomain.getHtmlContent().getBytes(“UTF-8”));
com.aspose.pdf.Document doc = new com.aspose.pdf.Document(input);
out = new ByteArrayOutputStream();
doc.save(out, com.aspose.words.SaveFormat.PDF);
If I create page numbers everything works fine, but I don’t want to create page numbers in footer if it already exists.

Do you know what is a problem here?

This is working for Word but for PDF not.
I attached both Word and PDF.

Regards

Hi Milan,

Thanks for contacting support.

I have tested the scenario using Aspose.Pdf for Java 17.4 while using following code snippet and as per my observations, the page number information appears in resultant document. For your reference, I have also attached the input HTML and output PDF generated over my end.

[Java]

// Open the source PDF document
com.aspose.pdf.Document doc = **new** com.aspose.pdf.Document("c:/pdftest/Input.html", **new** com.aspose.pdf.HtmlLoadOptions());
// Save the output file
doc.save(“c:/pdftest/output.pdf”);

Hi,

How your example is valid? Page number is not in footer section, it is just below text.

I attached pdf files with issue and with expected behavior.
Also, I attached simple Java program (FooterProblem.zip) to simulate issues.

I am using Aspose.Pdf for Java 17.4

Regards

Hi Milan,


Thanks for sharing the details.

In earlier attempt, I placed the HTML content in PDF file and it appeared in same manner as it appeared in web-browser (may be there were not enough contents, so PageNumber appeared right after the content). Furthermore, I have observed that you are using Aspose.Words for Java to perform the conversion, so we are further investigating the scenario while using this API.

Meanwhile during my testing with latest release of Aspose.Pdf for Java 17.4, I am able to see page number being rendered in PDF document but its rendering on subsequent page. For the sake of correction, I have logged it as PDFJAVA-36798 in our issue tracking system. We will further look into the details of this problem and will keep you posted on the status of correction. Please be patient and spare us little time. We are sorry for this inconvenience.

For your reference, I have also attached the output files generated over my end.

Hi Milan,

Specified below is the code snippet specific to Aspose.Pdf for Java API.

[Java]

private static void downloadDocumentAsPDF(String htmlContent, String fileName)
{
 byte[] input;
 try
 {
    input = htmlContent.getBytes(“UTF - 8”);
    com.aspose.pdf.Document pdfDoc = new com.aspose.pdf.Document(new ByteArrayInputStream(input), new com.aspose.pdf.HtmlLoadOptions());
    pdfDoc.save( “c:/ pdftest /”+fileName + “.pdf”);
 }
 catch (Exception ex)
 {
    throw new RuntimeException(ex);
 }
}

Hi Nayyer,

Thanks for the correction, it was my bad for using Aspose.Words instead Aspose.Pdf.

When can we expect this issue to be resolved? This functionality is very important to us.

Regards,
Milan

Hi Milan,


Thanks for the acknowledgement.

Please note that issues are resolved in first come first serve basis as we believe its the fairest policy to all the customers. Also, as we just have been able to notice the issue, so its pending for review and is not yet resolved. However, as soon as we have some definite updates regarding its resolution, we will let you know.

Please be patient and spare us little time.

@callidus,

Thanks for your patience.

We have further investigated earlier reported issue and as per our observations, it does not seem to be a bug as page-break-before property in second paragraph moves all content after it to next page according to CSS rules: specified over https://www.w3schools.com/cssref/pr_print_pagebb.asp

Should you have any further query, please feel free to contact.