|
From: <php...@li...> - 2007-08-15 13:27:43
|
Hello, I'm working on a project that needs pdfbox. I need to call a method which expects a subclass from abstract-class ProtectionPolicy. If i pass this object i get an IllegalArgumentException: Fatal error: Uncaught [[o:Exception]:"java.lang.Exception: Invoke failed: [[o:PDDocument]]->protect((o:ProtectionPolicy)[o:StandardProtectionPolicy]). Cause: java.lang.IllegalArgumentException Documentation: http://www.pdfbox.org/javadoc/org/pdfbox/pdmodel/encryption/StandardProtectionPolicy.html I believe i'm using it the right way. Anyone got an idea what i'm doing wrong? My code: $ap = new Java("org.pdfbox.pdmodel.encryption.AccessPermission"); $ap->setCanModify(false); $oDoc = new Java("org.pdfbox.pdmodel.PDDocument"); $oProtect = new Java("org.pdfbox.pdmodel.encryption.StandardProtectionPolicy ","test","test",$ap); $doc = $oDoc->load( "/home/www/testserver/webapp/upload/test.pdf"); $doc->protect($oProtect); $doc->save("/home/www/testserver/webapp/htdocs/testcases/out/testoutput.pdf"); Thanks in advance, Gilbert |