如何在HTML页面显示PDF

How to display PDF on the HTML page

我已将我的应用程序从 wicket 1.x 迁移到 wicket 8.x,现在在 iframe 上显示 PDF 时遇到错误。它在 iframe 上显示为空白。

我试图在页面加载时 HTML 的 iframe 标记中显示 PDF,但它显示为空白。

分享路径下的详细代码: https://github.com/smartuadk/Shared_Repo_Whosebug/tree/main/PDF_Preview

请在 Spring 安全模块 xml 文件中添加下面的 http security header 标记,以允许 Spring security 在 [=] 中显示 HTML iframe 19=] 申请:

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

这个解决方案对我有用,现在我的应用程序能够毫无错误地显示 iFrame,并且能够在 iFrame 中加载 PDF 文件。