🔒 Preview Without Risk - Hiding PDF Download & Print Options in Oracle APEX iFrame

🚩Introduction 

  • In many Oracle APEX applications, users need to preview documents like PDF files directly on the page without having to download them first. Embedding a PDF inside an iframe is a simple and clean way to do this, allowing users to read the document without leaving the application.

  • However, the default browser PDF toolbar that appears inside the iframe includes buttons like Download, Print etc. These options can be a concern when the document contains sensitive or confidential information that should only be viewed, not saved or shared. Hiding these toolbar options without any plugins keeps the preview clean and the content protected.

📑 Why This Approach Is Needed

In Oracle APEX applications, users often need to view reports, invoices, or documents directly on the page. But allowing them to freely download or print these files from the browser toolbar can be a security concern, especially when the content is confidential.

Restricting the PDF toolbar options inside an iframe becomes important when:

  • The document contains sensitive or confidential information that should not be downloaded
  • Users should only be allowed to view the file, not save or share it

  • The application needs to maintain control over how documents are accessed

  • A clean and distraction-free preview experience is important for the user

  • No third-party plugins or external libraries should be used in the implementation

This approach helps applications protect document content, gives developers control over what users can do with the file, and keeps the PDF preview simple and secure in Oracle APEX.

👉 Use Case: Previewing PDF in an iFrame with Restricted Toolbar

In Oracle APEX, users often need to preview PDF files such as invoices, reports, or certificates directly on the page. By embedding the PDF in an iframe and appending specific parameters to the file URL, the download button, print option, and other toolbar icons can be hidden from the browser's built-in PDF viewer without using any plugins.

In this blog, we will see how to preview a PDF file inside an iframe in Oracle APEX while hiding the toolbar options using the URL parameters. This helps to protect the document content, prevents unauthorised downloads, and keeps the viewing experience clean and controlled.

Step 1: 

In the Page Designer, create a region and select the type as Static Content.

Step 2: 

Click on the region and under the properties, navigate to the source section and create one iframe tag and we are using the sample pdf url for previewing the pdf file within the iframe.
<!-- IFrame PDF Preview  --> 

<
iframe src="https://pdfobject.com/pdf/sample.pdf" style="width:100%;height:80vh;"></iframe>

Step 3: 

Now save and run the page, you will see the pdf file preview with in the iframe which contains the download icon, print icon etc.

Step 4: 

To restrict these icons, we can hide these toolbars from the iframe container. To do so, go to the page designer, click on the region and under the HTML Code section, add these parameters at the end of the sample pdf url. 
<!-- IFrame PDF Preview -->

<
iframe src="https://pdfobject.com/pdf/sample.pdf#toolbar=0&navpanes=0&scrollbar=0" style="width:100%;height:80vh;"></iframe>

Step 5: 

These parameters will hide those toolbars, navigation panes from the page. Now save and run the page, the user can now only see the preview of the file, they cannot download or print it directly using the options available within the iframe.



🔥 Conclusion

Thus, in Oracle APEX, previewing a PDF inside an iframe while hiding the download and print options gives developers a simple and effective way to protect document content. It helps to restrict the user actions on sensitive files, keeps the preview clean and focused, and avoids the need for any third-party plugins, making it easy to implement and maintain in any Oracle APEX application.

Comments

Popular posts from this blog

🔍 Extending Smart Search Filter for Multiple Regions

📌Track Active Tab switch in Region Display Selector without any plugins

💡 Designing Dynamic QuickPicks in Oracle APEX