Jump to content

Recommended Posts

Posted (edited)

PDF Reader in AU3

During my time around here. I've seen a lot of people strugling to get a PDF file properly opened in AU3.

Well the obvious thing to do is to use the Acrobat Reader. But unfortunately, like a lot a AU3 users posted, it's not possible.

Unless you embed the reader in an IE object or use the Acrobat Writer (payed version) objects.

Well if you can't use the real thing, you will have to try your luck somewhere else !!

Therefor I use Foxit Reader (which is smaller, faster and if you ask me better than the real thing).

What you need it to download the ActiveX Control.

Foxit Reader ActiveX V2.3

Some secret to you all.

If you this version it has a disadvantage that is will show a label when opening the reader.

That you can only use it for Evaluation purposes. This label is also printed on each page :)

Here comes the solution.

Download the older version V1.0, if you need to print a lot.

And don't forget to register it !!

It shows the label when reading, but not when printing. muttley

Foxit Reader ActiveX V1.0

What can we say more then,

Enjoy !!

Foxit_Reader.au3

Regards,

ptrex

Edited by ptrex
Posted (edited)

".......But unfortunately, like a lot a AU3 users posted, it's not possible.

Unless you embed the reader in an IE object or use the Acrobat Writer (payed version) objects."

Mmmmh,

I have no problem with that.

The only problem is that Adobe not only changed the name (to Adobe Reader) but also the active X, starting with version 7.

The newer is documented in SDK.

However its always good to have an alternative, especially with a much smaller program.

Thanks for that, Reinhard

PS: Have a look at the eXpert PDF Reader, the only free reader which can write bookmarks.

Edited by ReFran
Posted

@Refran

I have no problem with that.

The only problem is that Adobe not only changed the name (to Adobe Reader) but also the active X, starting with version 7.

The newer is documented in SDK.

Thanks for the feefback.

But it would be nicer to post some examples as well.

Regards,

ptrex

Posted

............. But it would be nicer to post some examples as well.

No problem.

I just saw i note it as an example from you (Is that correct?). For me it works.

Here a link to further discusssion: http://www.autoitscript.com/forum/index.ph...=42631&st=0

Here the link to the Adobe SDK (Developing with Reader): http://www.adobe.com/devnet/acrobat/pdfs/reader_overview.pdf

Best regards, Reinhard

; 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:\Test.pdf"

;Declare objects

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

;Main Gui

GuiCreate("PDF Object", 802, 590,(@DesktopWidth-802)/2, (@DesktopHeight-590)/2 )

$oPDF.src=("C:\Test.pdf") ;should be used rather then .LoadFile

$GUI_ActiveX = GUICtrlCreateObj ($oPDF, 10, 10 , 780 , 550)

GUICtrlSetStyle ( $GUI_ActiveX, $WS_VISIBLE )

GUICtrlSetResizing ($GUI_ActiveX,$GUI_DOCKAUTO) ; Auto Resize Object

GuiSetState()

While 1

$msg = GuiGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

EndSelect

WEnd

$oPDF = ""

$GUIActiveX = ""

Exit

  • 1 month later...
Posted

Thanks for sharing this ptrex ;)

I've downloaded Foxit and started to play with. I've used your example and I tried to open a file - no matter what I tried I got always the same message:

The requested action with this object has failed.:

$PDFViewer.OpenFile(@ScriptDir&"100189.pdf", "")

$PDFViewer.OpenFile(@ScriptDir&"100189.pdf", "")^ ERROR

Here is the script:

#include<GUIConstantsEx.au3>
#include<WindowsConstants.au3>

Dim $objApp
$PDFViewer = ObjCreate("Foxit.FoxitReaderSDKCtrl.1") 

If Not IsObj($PDFViewer) Then 
    $PDFViewer = ObjCreate("Foxit.FoxitReaderSDKCtrl.2") 
    If Not IsObj($PDFViewer) Then 
    Exit
    EndIf
EndIf   

; Create GUI 
$Gui = GUICreate ( "Foxit PDF Reader", 830, 580,(@DesktopWidth-830)/2, (@DesktopHeight-580)/2 , _
                                Bitor($WS_OVERLAPPEDWINDOW ,$WS_VISIBLE , $WS_CLIPSIBLINGS))

;Creates an ActiveX control in the GUI.
$GUIActiveX = GUICtrlCreateObj ( $PDFViewer, -1, -1, @DesktopWidth, @DesktopHeight)
GUICtrlSetResizing ( $GUIActiveX, $GUI_DOCKAUTO)

; Show GUI
GUISetState ()
 
$PDFViewer.OpenFile(@ScriptDir&"100189.pdf", "")

While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend
    
GUIDelete()

I know that I'm doing something wrong but I can't figure what. Can you help me please? Thanks.

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

  • Moderators
Posted

I would imagine:

$PDFViewer.OpenFile(@ScriptDir&"100189.pdf", "")

To be:

$PDFViewer.OpenFile(@ScriptDir&"\100189.pdf", "")

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted

Thank you very much,

I thought I've been using the OpenFile in a wrong way (I'm only a novice regarding to COM objects), indeed it looks like the usage was correct. I'll have a look at other pdf COM.

Basically I'm interested in finding a text string within a pdf file and to display the page where it is found.

@SmOke_N - thank you for noticing that; it might have been a common mistake but I had my script located on the root of my C drive and I've tried both with or without "\" with the same result (I even put a FileExists statement before attempting to open the file).

Any idea about what can I use to continue my project?

Thank you,

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

  • 2 years later...
Posted

ptrex

See the notice water which is linked.

There is question to about foxit.

It requests a help.

When to help it will thank

Please. ptrex :x

I interest am many quite in AutoitScript.From that is [http://cafe.naver.com/autoitscript[/color]] Korea of cafe(blog) to be operating, [size="2"][color="#ff00ff"]English cannot well[/size].Many help it requests.To read, it stands it thanks.

Posted

@davidkim

1 st you have to register (maybe pay) to use the COM object at Foxit website.

2 workaround, read my first post carefully.

Here comes the solution.

Some secret to you all.

If you this version it has a disadvantage that is will show a label when opening the reader.

That you can only use it for Evaluation purposes. This label is also printed on each page

Here comes the solution.

Download the older version V1.0, if you need to print a lot.

Rgds

ptrex

Posted (edited)

@ptrex

@davidkim

1 st you have to register (maybe pay) to use the COM object at Foxit website.

2 workaround, read my first post carefully.

Here comes the solution.

Some secret to you all.

If you this version it has a disadvantage that is will show a label when opening the reader.

That you can only use it for Evaluation purposes. This label is also printed on each page

Here comes the solution.

Download the older version V1.0, if you need to print a lot.

Rgds

ptrex

Here comes the solution.

Download the older version V1.0, if you need to print a lot.

|-------------> It informs a download address and it requests

To reply, it thanks

It will be able to provide the annual festival which relates maybe in Foxit_PDF_SDK_DLL20.1021_enu(DLL) uses

(DLL Call Sample Code)

When the program is completed, it buys the choice goods.

ocx or DLL......

Edited by davidkim

I interest am many quite in AutoitScript.From that is [http://cafe.naver.com/autoitscript[/color]] Korea of cafe(blog) to be operating, [size="2"][color="#ff00ff"]English cannot well[/size].Many help it requests.To read, it stands it thanks.

Posted

@ptrex

Autoitscript studies the cold region 5 years is.

If under it is easy it stands and, in detail it sees it is difficult too a structure,

English also it does not know in addition well.

You and annoyingly it is sorry.

Frequently question it becomes the chart in about this problem.

The grammar does not hit well not to be, as well it is sorry. :x

I interest am many quite in AutoitScript.From that is [http://cafe.naver.com/autoitscript[/color]] Korea of cafe(blog) to be operating, [size="2"][color="#ff00ff"]English cannot well[/size].Many help it requests.To read, it stands it thanks.

Posted (edited)

To ptrex and trancexx.

trancexx and me will be wrong and they like, to have an interest, it stands they thank.

It is basic, the answer which is sincerity in question grudge only.

I cannot English well.

I am serious, It wants a reply in within question the before.

Please, reply it wishes in within question.

ptrex, trancexx I respect two people.

Edited by davidkim

I interest am many quite in AutoitScript.From that is [http://cafe.naver.com/autoitscript[/color]] Korea of cafe(blog) to be operating, [size="2"][color="#ff00ff"]English cannot well[/size].Many help it requests.To read, it stands it thanks.

Posted

@UEZ

I sent the question which relates in ActiveX.

The Google search already.

Must search with what?

Thanks UEZ

I interest am many quite in AutoitScript.From that is [http://cafe.naver.com/autoitscript[/color]] Korea of cafe(blog) to be operating, [size="2"][color="#ff00ff"]English cannot well[/size].Many help it requests.To read, it stands it thanks.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...