Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

PDF Reader in AU3


  • Please log in to reply
18 replies to this topic

#1 ptrex

ptrex

    Universalist

  • MVPs
  • 2,419 posts

Posted 12 July 2008 - 05:42 PM

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 !!

Attached File  Foxit_Reader.au3   792bytes   1442 downloads


Regards,

ptrex

Edited by ptrex, 14 September 2012 - 09:39 AM.








#2 ReFran

ReFran

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 554 posts

Posted 12 July 2008 - 09:11 PM

".......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, 12 July 2008 - 09:23 PM.


#3 ptrex

ptrex

    Universalist

  • MVPs
  • 2,419 posts

Posted 13 July 2008 - 10:29 AM

@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

#4 ReFran

ReFran

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 554 posts

Posted 13 July 2008 - 05:09 PM

............. 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



#5 ptrex

ptrex

    Universalist

  • MVPs
  • 2,419 posts

Posted 13 July 2008 - 06:22 PM

@Refran

I all forgot about this one. Indead I did post it long time ago.

I seem to reinvent myself at some times ? :muttley:

Anyhow the Foxit Reader is a good alternative though.

Regards,

ptrex

#6 enaiman

enaiman

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,922 posts

Posted 09 September 2008 - 06:33 AM

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:
Plain Text         
#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 :)


#7 ptrex

ptrex

    Universalist

  • MVPs
  • 2,419 posts

Posted 09 September 2008 - 07:33 AM

@enaiman

I noticed this too ?

Maybe there is a bug in the Foxitreader COM object or either AU3 does not handle this method correct ?

As you can see it should work in VB6

FoxitReader OpenFIle

regards,

ptrex

#8 SmOke_N

SmOke_N

    It's not what you know ... It's what you can prove!

  • Moderators
  • 15,730 posts

Posted 09 September 2008 - 01:16 PM

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.


#9 ptrex

ptrex

    Universalist

  • MVPs
  • 2,419 posts

Posted 09 September 2008 - 03:29 PM

@SmOke_N

I tried with the full path in there, but no go.

Thanks

Regards

ptrex

#10 enaiman

enaiman

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,922 posts

Posted 09 September 2008 - 10:45 PM

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 :)


#11 davidkim

davidkim

    Adventurer

  • Active Members
  • PipPip
  • 112 posts

Posted 13 December 2010 - 06:20 AM

ptrex

http://www.autoitscript.com/forum/topic/123105-how-to-ocx-file-link/page__p__855121__hl__foxitreadersdkctrl__fromsearch__1#entry855121

http://www.autoitscript.com/forum/topic/123121-object-error/page__p__855055__hl__foxitreadersdkctrl__fromsearch__1#entry855055

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] Korea of cafe(blog) to be operating, English cannot well.Many help it requests.To read, it stands it thanks.

#12 ptrex

ptrex

    Universalist

  • MVPs
  • 2,419 posts

Posted 13 December 2010 - 07:13 AM

@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

#13 davidkim

davidkim

    Adventurer

  • Active Members
  • PipPip
  • 112 posts

Posted 13 December 2010 - 08:48 AM

@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, 13 December 2010 - 08:51 AM.

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

#14 davidkim

davidkim

    Adventurer

  • Active Members
  • PipPip
  • 112 posts

Posted 13 December 2010 - 09:03 AM

@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] Korea of cafe(blog) to be operating, English cannot well.Many help it requests.To read, it stands it thanks.

#15 ptrex

ptrex

    Universalist

  • MVPs
  • 2,419 posts

Posted 13 December 2010 - 10:43 AM

@davidkim

Sorry me not understand !

rgds
ptrex

#16 trancexx

trancexx

    Queen F. Elizabeth MCXI

  • Active Members
  • PipPipPipPipPipPip
  • 6,158 posts

Posted 13 December 2010 - 10:47 AM

@davidkim

Sorry me not understand !

rgds
ptrex

davidkim said that your sorry ass is annoying.

...I don't know but I think he doesn't like you.

          ......       ......
        .:oOOOOo:.   .:oOOOOo:.
      .:oOO:'':Oo:. .:oO:'':OOo:.
     .:oO:      'Oo:oO'      :Oo:.
     :oO:         'o'   
      :Oo:
     :oO:                     :Oo:
     ':oO:     OT9AO0IEDrk   :Oo:'
      ':oO:                 :Oo:'
        ':oO.             .Oo:'
          ':oO
.         .Oo:'
            ':oO.     .Oo:'
              ':oO. .Oo:'
                'oO:Oo'
                  'o' :kiss:



 

.
eMyvnE


#17 davidkim

davidkim

    Adventurer

  • Active Members
  • PipPip
  • 112 posts

Posted 13 December 2010 - 02:28 PM

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, 13 December 2010 - 02:32 PM.

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

#18 UEZ

UEZ

    Never say never

  • MVPs
  • 4,829 posts

Posted 13 December 2010 - 02:37 PM

Try Google Translator

Br,
UEZ

 
The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯


#19 davidkim

davidkim

    Adventurer

  • Active Members
  • PipPip
  • 112 posts

Posted 13 December 2010 - 02:49 PM

@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] Korea of cafe(blog) to be operating, English cannot well.Many help it requests.To read, it stands it thanks.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users