Skip to content

Why does the PDF preview display an error or a blank page?

When previewing PDF documents using the View PDF button, JustOn Billing & Invoice Management may show an error or display an empty page even if the PDF file exists. A possible reason for this behavior may be a Salesforce security feature: preventing a page, button, or link from appearing on your page that comes from a frame or iframe – which is the case with PDF previews.

There are two approaches to allow the PDF preview anyway:

Note

Disabling clickjack protection lets any site frame the org's Visualforce pages. A trusted domain allows framing only from the listed domain, and all other domains stay blocked.

Allowlisting Domain for Inline Frames

Allowlisting your org domain for displaying iframes keeps the clickjack protection enabled.

To add your domain as a trusted domain for iframes:

  1. Click to enter Setup, then navigate to Security > Session Settings.
  2. In the Trusted Domains for Inline Frames section, click Add Domain.
  3. Specify the domain details.

    Field Value
    Domain Your org's Lightning domain
    mydomain.lightning.force.com
    IFrame Type Visualforce Pages
  4. Click Save.

    This allows your Lightning domain to display Visualforce pages in iframes. Consequently, the PDF preview displays normally.

    Test the PDF preview with the clickjack protection still enabled.

Disabling Clickjack Protection

Note

Disabling clickjack protection may make your Salesforce org less secure.

To disable the clickjack protection:

  1. Click to enter Setup, then navigate to Security > Session Settings.
  2. In the Clickjack Protection section, deselect the checkboxes Enable clickjack protection for customer Visualforce pages with standard headers and Enable clickjack protection for customer Visualforce pages with headers disabled.
  3. Click Save.

    This disables the clickjack protection. Consequently, the PDF preview displays normally.

    Remember that disabling clickjack protection may make your Salesforce org less secure.

Related information:

Enable Clickjack Protection for Visualforce Pages in the Salesforce Help
Specify Trusted Domains for Inline Frames in the Salesforce Help
Modify Session Security Settings in the Salesforce Help
Clickjack Protection for Salesforce Visualforce Pages Is Enabled and Field Service Pages Become Blank or Gives Error