Quote pdf page number

I want to add a page number to the pdf when printed to the Hubspot offer template. I tried the page and counter codes on css but it didn’t work. Can you help me?

Hi @TAkçay, I hope that you are well!
Thank you for asking the Community!
This is not yet a native feature. However, I’ve noticed a similar idea already present in our Ideas Forum: Adding page numbers to Quotes. To contribute, you can upvote the existing idea and share more details about your specific use case in the comments.
I also wanted to invite a couple of subject matter experts to this conversation: Hi @Bryantworks, @HubDoPete and @ChristinaKay do you have suggestions on which code to use to help @TAkçay, please?
If anybody else has anything to add and/or share, please feel free to join in the conversation :slightly_smiling_face:
Thanks a lot and have a great day!
Best,
Bérangère

Hi Tuğba

You “can” add page numbers but it takes some work, as they are not an automated feature.

Plan your template as a pagination loop with an incrementing page counter and embed your recurring template modules inside the loop. For example, force a cover/summary page as page 1, then add line items to page 2 onward. If you know how many line items you can reliably fit on a page (for example eight) then loop every 8 line items, forcing a page break and incrementing the page counter on each loop.

Then for the page to follow, force a page break and increment the page number for the last page.

So it’s fairly mechanical, but it also allows you to calculate the expected number of pages based on line item count, so you can print “Page 1 of X”

I also upvoted the ‘make it automatic’ post :slightly_smiling_face:

best

Pete

to Loop

Hi Pete,

Thank you for your answer. I’ll try to do as you say :blush:

Here is an example to set up your loop in the main template:

{% for row in LINE_ITEMS|batch(8) %}
{% set pageCount = loop.index %}
{% set TotalPage = LINE_ITEMS|batch(8)|length %}

<div class=“sheet cst-page-section loop-pages page-{{ loop.index + 1 }} {% if loop.last %}last-page{% endif %}”>

Good luck!

really thank you for helping me :folded_hands:

If you can’t add page numbers in HubSpot, I prefer using PDFChamp PDF Bates Numbering in this situation. You can first print the pages and then use PDFChamp to add page numbers to all the pages at once.