gpt4 book ai didi

java - 在 Java WebBrowser 控件中显示 PDF 时如何隐藏 Adob​​e Reader 工具栏?

转载 作者:行者123 更新时间:2023-12-01 15:44:32 25 4
gpt4 key购买 nike

我在 .NET 和文件中看到了同样的问题,但这是不同的:

我有一个 Java 应用程序,它调用带有一些参数的方法,以及它们之间的响应:

myCode.launchPDF(response, someOtherData...)

函数launchPDF获取带有参数的ByteArrayOutputStream使用响应向用户显示PDF:

private static void launchPDF(HttpServletResponse response, Object... someData) {
try{

ByteArrayOutputStream baos = getPDFFromWS(...);

response.setContentType("application/pdf");
response.setHeader("Content-Disposition","attachment; filename=\"example.pdf");
OutputStream out1 = response.getOutputStream();

if ( baos!=null && out1!=null)
baos.writeTo( out1 );

out1.flush();
out1.close();

if (!FacesContext.getCurrentInstance().getResponseComplete())
FacesContext.getCurrentInstance().responseComplete();
} catch (Exception e){...}
}

它工作完美......但是(这就是问题)我需要向应用程序的用户隐藏 PDF 的控件...

是否可以使用任何参数或类似的东西隐藏工具栏?是否可以控制pdf阅读器插件?是否可以在 PDF 中包含任何类型的脚本来隐藏工具栏?

非常感谢

最佳答案

您需要将 #toolbar=0 与 url 一起使用例如:http://somesite.com/file.pdf#toolbar=0

这将在没有工具栏的浏览器中打开 pdf 文档。

here是来自 adobe 的文档,介绍了显示 pdf 时的可用选项

关于java - 在 Java WebBrowser 控件中显示 PDF 时如何隐藏 Adob​​e Reader 工具栏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7347378/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com