Skip to main content
Participant
June 8, 2023
Answered

Is it possible to get the current page in the html template?

  • June 8, 2023
  • 2 replies
  • 718 views

Hi,
I've been looking at the @adobe/pdfservices-node-sdk documentation but I don't see anything related to getting the current page in the HTML.

Is it possible to get it from there? My idea is to make a custom footer and add the current page number along with other information.

This topic has been closed for replies.
Correct answer Raymond Camden

This is not currently possible with the API.

2 replies

Raymond Camden
Community Manager
Raymond CamdenCommunity ManagerCorrect answer
Community Manager
June 8, 2023

This is not currently possible with the API.

Legend
June 8, 2023

It's generally considered that HTML is not divided into pages, but a continuous stream. A conversion of HTML to PDF will be in pages, but that is not a property of the HTML.

carlos64_Author
Participant
June 8, 2023

Hi, thanks for the reply

In the mPDF library, these variables {PAGENO}/{nbpg} can be used in the html, which are transformed into: current page / number of total pages. The includesHeaderFooter method of the adobe api generates something similar in the default footer.

That's why I'm asking if it's possible to get that in a custom footer.

Thank you in advance

Legend
June 8, 2023

Ah, so it isn't actually a page number for the HTML (which wouldn't mean anything), it's a dynamic reference to the page number it WILL have in the PDF when converted. I see now. I hope someone has a suggestion for you. {nbpg} is interesting. It's convenient, but requires either a complete dummy run just to get the total page count before starting, or going back over the converted pages to stamp them later on... sometimes nice things come at a big cost.