Ocean West Posted December 8, 2011 Posted December 8, 2011 Between the various tools how would I get the page count of a PDF iText & ScriptMaster SuperContainer Plugin Scribe
Ocean West Posted December 9, 2011 Author Posted December 9, 2011 Thanks john renfrew RegisterGroovy( "PDFpage( filePathName ; masterPass )" ; "import com.itextpdf.text.pdf.PdfReader¶ if (masterPass == null) {¶ OWNER = null¶ } else {¶ OWNER = masterPass.getBytes()¶ } //end if¶ try {¶ reader = new PdfReader(filePathName, OWNER)¶ } catch (Exception e) {¶ if (e.toString().contains('BadPassword')) {¶ return 'PASSWORD ERROR'¶ } else {¶ return 'ERROR'¶ }//end if¶ return reader.getNumberOfPages()" )
Newbies Drew Wesley Posted May 22, 2012 Newbies Posted May 22, 2012 I loaded the iText jar, registered the function, but in text viewer, I'm getting this string: com.itextpdf.text.pdf.PdfReader@17361e2 What am I doing wrong? Thanks!
john renfrew Posted May 23, 2012 Posted May 23, 2012 Nothing There is a TINY mistake Last three lines should be }//end if }//end try return reader.getNumberOfPages() without the missing closing } you are just returning the fact that there is a reader object created as the getPages needs to be outside the try
Recommended Posts
This topic is 4566 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now