我使用以下代码打开pdf。
try
{
File file = new File("Sample.pdf");
java.awt.Desktop.getDeskTop().open(file);
System.out.println("File opened successfully");
}catch(Exception ex)
{
System.out.println("Error occurred: "+ex);
}
现在我想在打开之前禁用 pdf 文件中的保存、另存为、打印选项。我试过这个链接。但它不起作用。
它会引发以下错误。
Exception in thread "main" java.lang.NoClassDefFoundError: org/bouncycastle/cms/Recipient
Caused by: java.lang.ClassNotFoundException: org.bouncycastle.cms.Recipient
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 1 more
如何禁用给定pdf文件的保存,另存为,打印选项?