Skip to main content
Participant
Jun 8, 2023 3:20 AM UTC
Answered

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

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 is closed to new replies. Start a new post to keep the conversation going.
Raymond Camden
Raymond CamdenCorrect answer
Community Manager
Jun 8, 2023 7:25 PM UTC

This is not currently possible with the API.

5 replies

Raymond Camden
Community Manager
Raymond CamdenCommunity ManagerCorrect answer
Community Manager
Jun 8, 2023 7:25 PM UTC

This is not currently possible with the API.

Translate
Legend
Jun 8, 2023 6:47 AM UTC

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.

Translate
carlos64_Author
Participant
Jun 8, 2023 7:52 AM UTC

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

Translate
Legend
Jun 8, 2023 9:36 AM UTC

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.

Translate