Sign in to follow this  
Followers 0
Hasher

PDF get page count.

3 posts in this topic

Hi all

I'm not experienced with you using ObjCreate . , I have this code below which runs fine but doesn't return any value or throw up any errors, Can someone tell me where i am going wrong ?

Thanks in advance

Paul

$Num = GetPagesCount($File)
ConsoleWrite($Num)

func GetPagesCount($target); count pages
    $AcroPDDoc = ObjCreate("AcroExch.PDDoc")
    if @error then return -1
    $bPDF = $AcroPDDoc.Open($target)
    if @error then return -2
    $Pages= $AcroPDDoc.GetNumPages
    $bPDF = $AcroPDDoc.Close
    return $pages
endfunc

Firefox's secret is the same as Jessica Simpson's: its effortless, glamorous style is the result of — shhh — extensions!

Share this post


Link to post
Share on other sites



Actually, it does return an error for me. It is the -1 (which I have replaced with another number to make sure it is stopping at that point). Therefore, for me, it was not creating the object. I looked online and found this discussion:

http://www.codeguru.com/forum/showthread.php?t=31751

In there, they say you must have Acrobat Writer installed to be able to create the AcroExch.PDDoc object. Do you have the needed software installed on your system?


#include <ByteMe.au3>

Share this post


Link to post
Share on other sites

".. they say you must have Acrobat Writer installed to be able to create the AcroExch.PDDoc object .."

The productname is Adobe Acrobat (professional or standard, however a $$$ product) and yes it must be installed to use AcroExch... object. If you only want the page count you can use a freeware commandline tool like pdfTk or you can do it with poor autoIt code, reading the pagenumber direct from the pdf-objects.

HTH, Reinhard

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0