Integrate Page Number in Footer of an offer

Hi

We are trying to integrate the page number in the footer of an offer. The page number should be visible on every page of the offer. Does anybody know if this is possible and how it can be done?

Thanks for your help.

Best,
Sarah

Hello @SMeyerSuarez

You can achieve this by using HubL code to generate and display the page number dynamically.

Here’s an example of how you can add page numbers to the footer of an offer in HubSpot:

  1. Navigate to the template editor of the offer template you want to add page numbers to.
  2. Click on the footer section of the template.
  3. Add a new module to the footer section and select “Custom HTML” as the module type.
  4. In the HTML editor, add the following HubL code
{% set total_pages = content.html|split('<!-- pagebreak -->')|length %}
{% set current_page = content.html|split('<!-- pagebreak -->').index(content.html) + 1 %}
Page {{ current_page }} of {{ total_pages }}
​
  1. Save the module and publish the changes to the template.

This code works by splitting the content of the offer template at each page break marker (<!-- pagebreak -->) and then calculating the total number of pages and the current page number based on the index of the current page in the split array.

Make sure to replace content.html with the appropriate variable for the content of your offer template.

Hi

THank you for your help. This is awesome. We will try it out asap.

Have a great day.

Sarah

Hi Himanshu

I have another question: Is it possible to insert a header with the company logo, which will be shown on each page if you print the offer? How can we make sure that there is no text on top of the logo? Can we reserve the top as a header where there will be no other text displayed than the logo?
Plus do you know if we can create sections in an offer? So that text that belongs to eachoter isn’t ripped apart by page breakes? If you can send me some inputs I am super grateful. Thanks.
Sarah

Hi Himanshu
We tried to implement the footer page number as you described above. Unfortunately it was not possible to implement the page number on the pdf file. We do not only need the page number on the xml-offer but we need it when you export the offer to a pdf. With what do we need to exchange the code content.html? Do you have another solution? Or is it possible to talk to you personally? Thanks.

Best regards,
Sarah