How to show / hide pages in a PDF based on a condition - March-25
I got a very good question from a PDF Potion user this week:
Can I show or hide certain pages of my PDF based on who is generating it (or some other condition?
The answer is yes.
Hereâs how to do it
You may want to show or hide certain pages in your PDF based on some condition (for example the userâs role). You can use URL parameters and conditions to do this.
In the below example, weâve designed a PDF on the âtest-quoteâ page of our app. There are 5 separate sections (or pages) to our PDF. Weâre using a separate group (and 1 repeating group) for each of the pages.
Each user in our app has a âroleâ. They can be either an âAdminâ or a âCustomerâ:
Letâs say we only want the âGroup - Signatureâ page to appear in our PDF if the user creating the PDF is an âadminâ. This is the âGroup - Signatureâ page:
We can control the visibility of this group by adding a URL parameter to the âpageâ field in the âCreate PDFâ action.
In the above image, if the current user has an âadminâ role, the âPage Nameâ is going to be:
test-quote?admin=yes
If the current user is a âcustomerâ, the âPage Nameâ is going to be:
test-quote?admin=no
We can use the URL parameter to show/hide the âGroup - Signatureâ page in your PDF. Click on the relevant group and add a condition like the following:
Make sure you check the âcollapse when hiddenâ option on the group:
Now when we create the PDF as a user with the âCustomerâ role, the signature page does not appear in the PDF:

But when we create the PDF as a user with the âAdminâ role, the signature page does appear:

Note: the showing / hiding of pages in your PDF does NOT have to be related to the userâs role. You can use any condition you want and link it to a URL parameter.
Any questions let me know!
Useful links: