(HTML2PDF) Page numbers not showing on report footer on Linux

Product: Apryse SDK + HTML2PDF

Product Version: 11.6.0

Please give a brief summary of your issue:
Page numbers not showing on report from Linux

Please describe your issue and provide steps to reproduce it:
Using HTML2PDF, I’m trying to print page number on the footer but it’s always blank. The same code works on Windows.

	PDFDoc pdfDoc = new PDFDoc();
	try (HTML2PDF converter = new HTML2PDF()) {
		converter.setHeader(getHeader());
		converter.setFooter(getFooter());
		converter.setMargins("2.2cm", "2.2cm", "2.2cm", "2.2cm");
		converter.insertFromHtmlString(html, settings);
		converter.convert(pdfDoc);
	} catch (PDFNetException e) {
		System.err.println("Apryse HTML2PDF conversion error: " + e.getMessage());
		throw new RuntimeException("Apryse HTML2PDF conversion failed", e);
	}

	// ...

	static String getFooter() {
		return "<div style='width: 100%; font-size: 12px; margin: 0 96px 32px; display: flex; flex-direction: row; justify-content: space-between;'>" +
				"<div>Footer</div>" +
				"<div><span class='pageNumber'></span></div>" +
				"</div>";
	}

Please provide a link to a minimal sample where the issue is reproducible:

1 Like

Hello, I’m AiRon, an automated tech support bot :robot:
While you wait for one of our customer support representatives, I can help you with your question.


It seems that you are experiencing an issue with displaying page numbers in the footer when using the HTML2PDF feature of Apryse SDK on a Linux environment. The problem could be due to differences in how CSS is rendered or fonts are handled between Windows and Linux.

Some things you can try:

  • Ensure that all required fonts are installed on your Linux system. Missing fonts can cause rendering issues.

  • Check if the CSS styles for the footer are correctly being applied by inspecting the generated PDF.

  • Try using absolute positioning in your CSS to ensure the footer is placed correctly.

  • Test with a simple HTML/CSS to see if the issue persists, isolating the problem to specific CSS properties or HTML structures.

  • Verify that the HTML2PDF conversion settings are consistent across platforms.



Here are some resources that might help you:


Hopefully, this helps you solve your problem while you wait for a human to get back to you.

1 Like

Hello Lucas,

Page numbers for headers and footers not displaying in the generated PDF is a known issue with the current release of the HTML2PDF module. We have an experimental release available that corrects this issue you can download here:
Download HTML2PDF Module

Can you try it out and let me know if it corrects your missing page numbers on Linux?

1 Like

Yes, this fixed the issue!

Good to hear Lucas, happy to help.