Ocean West Posted December 8, 2011 Share Posted December 8, 2011 Between the various tools how would I get the page count of a PDF iText & ScriptMaster SuperContainer Plugin Scribe Link to comment Share on other sites More sharing options...
Ocean West Posted December 9, 2011 Author Share 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()" ) Link to comment Share on other sites More sharing options...
Newbies Drew Wesley Posted May 22, 2012 Newbies Share 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! Link to comment Share on other sites More sharing options...
john renfrew Posted May 23, 2012 Share 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 Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 4378 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