November 11, 200916 yr I read that you can use iText in ScriptMaster to manipulate a PDF file. I was wondering if someone can give me a script to find out the pagecount of a PDF file. Like the GetFileSize (filePath) but instead of returning the File Size, returns the Page Count. I'm not even sure how to import the iText.jar into ScriptMaster. I added it using the Add button on ScriptMaster, but do I need to add it once? Or do I have to also open it in my other solution? Thanks.
November 11, 200916 yr I read that you can use iText in ScriptMaster to manipulate a PDF file. I was wondering if someone can give me a script to find out the pagecount of a PDF file. Like the GetFileSize (filePath) but instead of returning the File Size, returns the Page Count. I can give an estimate for writing this ScriptMaster module, if you're interested. I'm not even sure how to import the iText.jar into ScriptMaster. I added it using the Add button on ScriptMaster, but do I need to add it once? Or do I have to also open it in my other solution? Just adding the jar should suffice, all the jars get loaded at startup of ScriptMaster.fp7
November 11, 200916 yr Author I can give an estimate for writing this ScriptMaster module, if you're interested. Sure, I'm interested. Just adding the jar should suffice, all the jars get loaded at startup of ScriptMaster.fp7 What if I don't want to use the ScriptMaster.fp7? I loaded some of the modules into my own solution by adding them into my startup script. I guess I would need to add SMLoadJar on my startup if I want to use iText.jar?
November 12, 200916 yr Yes you would need to use SMLoadJar to load any additional libraries such as iText. Here is the iText code for the page count though PdfReader reader = new PdfReader("some.pdf "); int n = reader.getNumberOfPages();
November 12, 200916 yr Author Yes you would need to use SMLoadJar to load any additional libraries such as iText. Here is the iText code for the page count though PdfReader reader = new PdfReader("some.pdf "); int n = reader.getNumberOfPages(); Thank you so much! I don't know if I'm doing this right but I cannot Register the Function in the ScriptMaster. I added and iText.jar in the Jar Libraries then created the script.. PdfReader reader = new PdfReader("some.pdf "); int n = reader.getNumberOfPages(); And then when I click the Register Function it gave me an error message.. "You cannot register this function, because it will not compile" What do you think am I mising here?
November 12, 200916 yr Probably b/c you're missing an import statement. There is no class PdfReader in Java runtime, you need explicitly add import statement that import individual classes or packages from third party jars. Try adding: import com.lowagie.text.pdf.PdfReader
November 12, 200916 yr Author Probably b/c you're missing an import statement. There is no class PdfReader in Java runtime, you need explicitly add import statement that import individual classes or packages from third party jars. Try adding: import com.lowagie.text.pdf.PdfReader Awesome! Works perfect! :yourock:
December 7, 200916 yr For the life of me, I cannot get this to work. I've loaded the iText jar into ScriptMaster, and created a new script. However, I cannot get this script to recognize that it needs an input variable. So, in FM, it lists as PDF PageCount, and does not expect a parameter. I'm definitely overlooking something obvious. SMGrab1.pdf Grab2.pdf
December 7, 200916 yr Perseverance! I fell for the once you've registered it won't reregister until you SMReset or quit FM. Also, I fed it a FM path, and not an OS path. I feel so smart!
Create an account or sign in to comment