iText Java禁用打印pdf [英] iText Java disable print pdf

查看:642
本文介绍了iText Java禁用打印pdf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用以下代码来禁用PDF中的打印"选项.效果很好.

We are using the following code to disable Print option in PDF. Works really well.

    PdfReader reader = new PdfReader("my-old-file.pdf");
    PdfStamper stamper = new PdfStamper(reader, new FileOutputStream("my-new-file.pdf"));
    stamper.setEncryption("my-owner-password".getBytes(), "my-user-password".getBytes(),
    PdfWriter.AllowCopy, PdfWriter.STRENGTH40BITS);
    stamper.close();

直到昨天,一切都是笨拙的.我们决定将PDF Reader的版本从8.2更新到9.3 打印选项不再被禁用!看起来只有当我们安装了Adobe Acrobat Reader 8时,此代码才有效.对于其他版本,它不会禁用复制或打印按钮.

Everything was hunky dory till yesterday. We decided to update PDF Reader version to 9.3 from version 8.2 The print option is not disabled anymore! Looks like this code only works if we have Adobe Acrobat Reader 8 installed. For other versions, it does not disable the copy or print buttons.

请帮助.
谢谢

Please help.
Thanks

推荐答案

我看不到Adobe只是放弃对那些安全标志的支持,但它们可能已经对STRENGTH40BITS感到厌烦.我建议您更新到STRENGTH128BITS.

I don't see Adobe simply dropping support for those security flags, but they may have grown weary of STRENGTH40BITS. I suggest you update to STRENGTH128BITS.

那是Adobe Bug.

That or it's an Adobe Bug.

PS:Acrobat的最新版本是9.4,您可以尝试使用该版本……赔率很高,但值得一试. 9.3有点片状.

PS: The latest version of Acrobat is 9.4, you might try that version instead... long odds but worth a shot. 9.3 was a tad flaky.

可悲的是,这一切都是我的猜测.好打猎.

Sadly, this is all guess-work on my part. Good hunting.

这篇关于iText Java禁用打印pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆