我使用以下代码开放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文件中禁用保存,另存为,打印选项。我试过这个link。但它不会工作。
发生以下错误。
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文件禁用保存,另存为,打印选项?