Sign in to follow this  
Followers 0
doucment

USE PDF COM ?

7 posts in this topic

I want to write a script about PDF. I need to OPEN PDF document in my Script,how I do it ?

Share this post


Link to post
Share on other sites



I want to write a script about PDF. I need to OPEN PDF document in my Script,how I do it ?

Adobe opened their definition of .pdf files so anyone can write a program to read and write them, providing certain Adobe policies are maintained, like respecting read-only settings inside the file. There now are many free/open source apps to open and create .pdf files, and of course the free Adobe Acrobat Reader too.

From http://en.wikipedia.org/wiki/.pdf:

Free readers for many platforms are available: the free Adobe Reader by Adobe Systems, the free Foxit Reader, and several free open source readers, including Xpdf, KPDF, GPdf, Evince, GSPdf and ViewPDF, and front-ends for many platforms to Ghostscript.


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Xpdf 3.01pl1 was released 2005-dec-01.

http://www.foolabs.com/xpdf/download.html

Nov 29, 2005: KPDF 0.5.0 released

http://kpdf.kde.org/news.php#itemKPDF050released

2003-07-01 jdub has just uploaded the GPdf 0.104 tarball.

http://web.inf.tu-dresden.de/~mk793652/gpdf/

evince

http://www.gnome.org/projects/evince/

GSPdf

http://www.gnustep.it/enrico/gspdf/

viewpdf

(break)

http://packages.debian.org/unstable/text/viewpdf

Most of them are run on Unix or Linux.

Autoit can only run on Windows.

Is there acrobat reader SDK to download?

Share this post


Link to post
Share on other sites

Most of them are run on Unix or Linux.

Autoit can only run on Windows.

Is there acrobat reader SDK to download?

Google "PDF SDK" and you get more than a million hits...

Also, OpenOffice.org is free and open source, has a command line interface for its macro language, and does PDF inport/export natively (not to mention ODF, DOC, etc.).


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Maybe we're overcomplicating the question. How about this?

Run("C:\program files\adobe\reader\reader.exe pathtoPDFfile.pdf")

Share this post


Link to post
Share on other sites

Hi This shouls get you started:

This Sample access the ActiveX component of the Adobe Reader.

There is still a problem opening a file. But Googling your way around, you should find the solution.

; Author:   ptrex
; AutoIt Version: 3.1.1.103
; Description: Very Simple example: Embedding Acrobat PDF object
; Needs: Acrobat Reader to be installed
; Date: 25 jan 2006

#include <GUIConstants.au3>
#NoTrayIcon

;Vars
Dim $oMyError
Dim $File
Dim $Version

;$File="C:\Program Files\Adobe\Acrobat 7.0\Help\ENU\Reader.pdf"

;Declare objects
$oPDF = ObjCreate("AcroPDF.PDF.1");

$Version=$oPDF.GetVersions

;Main Gui
GuiCreate("PDF Object", 802, 590,(@DesktopWidth-802)/2, (@DesktopHeight-590)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
;$oPDF.LoadFile("C:\Program Files\Adobe\Acrobat 7.0\Help\ENU\Reader.pdf")
$GUI_ActiveX = GUICtrlCreateObj ($oPDF, 10, 10 , 780 , 550)
GUICtrlSetStyle ( $GUI_ActiveX,  $WS_VISIBLE )
GUICtrlSetResizing ($GUI_ActiveX,$GUI_DOCKAUTO) ; Auto Resize Object
    
    
GuiSetState()

MsgBox(0,"Show Versions",$Version)

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    EndSelect
WEnd
$oPDF = ""
$GUIActiveX = ""
Exit

;This is SvenP 's custom error handler
Func MyErrFunc()
  $HexNumber=hex($oMyError.number,8)
  Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !"     & @CRLF  & @CRLF & _
             "err.description is: " & @TAB & $oMyError.description  & @CRLF & _
             "err.windescription:"   & @TAB & $oMyError.windescription & @CRLF & _
             "err.number is: "       & @TAB & $HexNumber              & @CRLF & _
             "err.lastdllerror is: "   & @TAB & $oMyError.lastdllerror   & @CRLF & _
             "err.scriptline is: "   & @TAB & $oMyError.scriptline   & @CRLF & _
             "err.source is: "       & @TAB & $oMyError.source       & @CRLF & _
             "err.helpfile is: "       & @TAB & $oMyError.helpfile     & @CRLF & _
             "err.helpcontext is: " & @TAB & $oMyError.helpcontext _
            )
  SetError(1) ; to check for after this function returns
Endfunc

Enjoy.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

You should use the src property of the PDF object instead of the loadfile method.

;$oPDF.LoadFile("C:\Program Files\Adobe\Acrobat 7.0\Help\ENU\Reader.pdf")
$oPDF.src="C:\Program Files\Adobe\Acrobat 7.0\Help\ENU\Reader.pdf"

It worked well with AutoIt v. 3.1.1.125 and c:\Program Files\Adobe\Acrobat7.0\ActiveX\AcroPDF.dll

Edited by JKL

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