Hi Tobias Here's a testcase. In sid it works fine, but if I use the jars provided in testing it fails.
Important: the pdf file is "protected" , so it's necesary bouncycastle
to decrpyt it. Normal pdf files don't fail because they don't need
bouncycastle.
Attached sample pdf and sample java that counts the pages of a pdf.
Sid. It prints the expected output
pages = 1
In Testing: throws this exception:
Exception in thread "main" java.lang.NoClassDefFoundError:
org/bouncycastle/asn1/ASN1ObjectIdentifier
at com.lowagie.text.pdf.PdfEncryption.<init>(Unknown Source)
at com.lowagie.text.pdf.PdfReader.readDecryptedDocObj(Unknown Source)
at com.lowagie.text.pdf.PdfReader.readDocObj(Unknown Source)
at com.lowagie.text.pdf.PdfReader.readPdf(Unknown Source)
at com.lowagie.text.pdf.PdfReader.<init>(Unknown Source)
at com.lowagie.text.pdf.PdfReader.<init>(Unknown Source)
at Main.main(Main.java:17)
Caused by: java.lang.ClassNotFoundException:
org.bouncycastle.asn1.ASN1ObjectIdentifier
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 7 more
example2.pdf
Description: Adobe PDF document
import java.io.IOException;
import com.lowagie.text.pdf.PdfReader;
public class Main {
/**
* Test http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=687692
* @throws IOException
*/
public static void main(String[] args) throws IOException {
String fileName = "example2.pdf";
if (args != null && args.length > 0){
fileName = args[0];
}
PdfReader reader = new PdfReader(fileName);
System.out.println("pages = " + reader.getNumberOfPages());
reader.close();
}
}

