How to display PDF on the HTML page

256 views Asked by At

I have migrated my application from wicket 1.x to wicket 8.x and now facing an error to display PDF on iframe. It is showing as blank on the iframe.

I am trying to display PDF in the iframe tag in the HTML on page load but it is showing as blank.

Share the detailed code below path: https://github.com/smartuadk/Shared_Repo_StackOverflow/tree/main/PDF_Preview

1

There are 1 answers

0
user3552342 On BEST ANSWER

Please add below http security header tag in Spring security module xml file to allow Spring security to display the HTML iframe in spring application:

<security:http use-expressions="false">
    <security:headers>
        <security:frame-options disabled="true"></security:frame-options>
    </security:headers>
</security:http>

This solution worked for me and now my application is able to display the iFrame without any error and able to load PDF file in iFrame as well.