Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is the Adobe Acrobat ActiveX control in 6 more stable? 2

Status
Not open for further replies.

Sammybobo

Programmer
Joined
Apr 4, 2003
Messages
87
Location
US
Hi:

I've gotten trememdous help from the gurus on VFP and PDF interaction. Before making a decision, I am wondering if the ActiveX control in version 6 is better than in 5. Are the instability issues the same or has there been a minor or significant improvement? Thanks.

Sammybobo
 
Sammybobo

One irritating form of behaviour with the ActiveX control was that in version 5.0 and earlier of the Adobe Reader, if a user opened the Adobe Reader whilst a VFP form with the ActiveX control was displaying a .pdf, the ActiveX control would simply dissapear from the VFP form.

In version 6.0.n of the Adobe Reader, it seems that you can launch it and the ActiveX control and .pdf remains showing in the VFP form.

However should you then close the Adobe Reader, with or without it displaying a .pdf, again the ActiveX control and .pdf will simply dissapear from the VFP form.

When I did use the ActiveX control, I used a generic timer to 'watch' for the appearance of the Adobe Reader and it would give a messagebox warning with timeout to the user and then release the VFP form, so that the Adobe Reader and the VFP form were never running at the same time.

FAQ184-2483 - answering getting answered.​
Chris [pc2]
PDFcommandertm.com
PDFcommandertm.co.uk


 
Thanks, Chris. That was very helpful. I really appreciate that. Could you share the timer watch snippet, please? Again, thanks.

Sammybobo
 
Code:
[COLOR=green]*!* Check for Adobe Reader running[/color][COLOR=blue]
lnHand = IsRun32([Adobe Reader -])

IF lnHand # 0
[tab]MESSAGEBOX( ;
[tab][tab][My application has detected that the Adobe Reader is in use] ;
[tab][tab]+ CHR(13) ;
[tab][tab]+ CHR(13) ;			
[tab][tab]+ [My applications version will be terminated],;
[tab][tab]0 + 64 + 0 ,;
[tab][tab][Adobe Reader],;
[tab][tab]2000)

[tab]WITH THISFORM
[tab][tab].Hide()
[tab][tab].Release()
[tab]ENDW	
ENDI[/color]


Code:
[COLOR=green]* FUNCTION: Is_Run32.prg
* AUTHOR: George Tasker
* DATE: January 13, 1998 - 8:26 AM
* PURPOSE: Determines if a Windows
* application is running and returns
* the handle of the window if it is,
* otherwise returns 0. 32 bit version
* for Windows 95/NT 3.51-4
* Modified 5/20/2001 - gt
[/color][COLOR=blue]
FUNCTION IsRun32
LPARAMETER pctitle
[/color][COLOR=green]
* Parameter list description
*
* pctitle - The title bar of the Window
*   Note: The title does not have to be
*   the complete title that appears
*
*
* API Declarations[/color][COLOR=blue]
DECLARE INTEGER GetDesktopWindow IN Win32API
DECLARE INTEGER GetWindow IN Win32API ;
[tab]INTEGER hwnd ,;
[tab]INTEGER dflag
DECLARE INTEGER GetWindowText IN Win32API ;
[tab]INTEGER hwnd ,;
[tab]STRING @lptstr ,;
[tab]INTEGER cbmax

LOCAL lnhwnd ,;
[tab]lnnext ,;
[tab]lldone ,;
[tab]lctitle_bar ,;
[tab]lcsearchfor ,;
[tab]lntext_len

lcsearchfor = UPPER(ALLTRIM(pctitle))
lnhwnd = GetDesktopWindow()
lnhwnd = GetWindow(lnhwnd, 5)[/color][COLOR=green] && Get first child window[/color][COLOR=blue]
lnnext = 2
lldone = .F.
lctitle_bar = []

DO WHILE !lldone
[tab]IF !EMPTY(lnhwnd)
[tab][tab]lctitle_bar = SPACE(200) + CHR(0)
[tab][tab]lntext_len = GetWindowText(lnhwnd, @lctitle_bar, 200)
[tab][tab]lctitle_bar = UPPER(LEFT(lctitle_bar, lntext_len))
[tab][tab]lldone = (lcsearchfor $ lctitle_bar)
[tab][tab]IF !lldone
[tab][tab][tab]lnhwnd = GetWindow(lnhwnd, lnnext)
[tab][tab]ENDIF
[tab]ELSE
[tab][tab]lldone = .T.
[tab]ENDIF
ENDDO

RETURN lnhwnd[/color][COLOR=green] && If 0, not found()[/color]

FAQ184-2483 - answering getting answered.​
Chris [pc2]
PDFcommandertm.com
PDFcommandertm.co.uk


 
Great! I'll give it a try. God bless you.

Sammybobo
 
Sammybobo

In revisiting the ActiveX control for Adobe Reader 6.0.n, noticed that although most methods work as predicted with a few exceptions, namely .AboutBox(), .setLayoutMode() and .setPageMode().

There is no parameter for .AboutBox() and nothing happens.

There are undocumented string parameters for .setLayoutMode() and .setPageMode() - unable to find them in the Adobe SDK - any ideas as to what they should be?

FAQ184-2483 - answering getting answered.​
Chris [pc2]
PDFcommandertm.com
PDFcommandertm.co.uk


 
Hi Chris:

Thanks for the heads-up tip. I have no idea for any of those methods. Actually, I do not have the SDK, I only have Reader 6 and Acrobat 5. Any further help is appreciated.

Sammybobo
 
Sammybobo

The Adobe SDK is available as a free download at Adobe SDK Download.

Apart from the problem with the 'clash' with the Adobe Reader, the ActiveX control version 6.0.n does seem more stable than previous versions and although testing has been limited, have yet to get a C05 error.

I appreciate you now have a preferred solution with the TypeLib, so this thread may now become academic for you but may be helpful to others.

I'm curious as to why those methods don't work.

The obvious reason is that the parameters passed are incorrect.

If you were to modify a postscript file by the use of the pdfmark operator, ( a PostScript extension only implemented in Acrobat Distiller or equivalent as opposed to PostScript printers), you can control the layout mode by using the parameters:-

UseNone - Document displayed without bookmarks and thumbnails
UseThumbs - Document displayed with thumbnails
UseOutlines - Document displayed with bookmarks
Fullscreen - Document displayed in full-screen mode

Using the TypeLib alternative, you have the equivalent constants:-

#DEFINE PDUseNone 0
#DEFINE PDUseThumbs 2
#DEFINE PDUseBookmarks 3
#DEFINE PDFullScreen 4

You then have a similar situation in respect of the .setPageMode() method with pdfmark operator parameters and the equivalent TypeLib constants.

So logic would say the string parameters for the ActiveX control would be derivatives of either pdfmark operator parameters or the equivalent TypeLib constants.

What those methods working would give is full control of the ActiveX control by VFP, hence the curiousity.



FAQ184-2483 - answering getting answered.​
Chris [pc2]
PDFcommandertm.com
PDFcommandertm.co.uk


 

After considerable trawling of the net have found the parameters for the .setPageMode() method of the ActiveX control
Code:
[COLOR=blue]oForm.olecontrol1.setPageMode([page])
oForm.olecontrol1.setPageMode([pages only])
oForm.olecontrol1.setPageMode([thumbnail and pages])
oForm.olecontrol1.setPageMode([bookmark and pages])[/color]
The first two parameters are interchangeable.

The search continues... [smile]

FAQ184-2483 - answering getting answered.​
Chris [pc2]
PDFcommandertm.com
PDFcommandertm.co.uk


 
Chris

That trawling is worth a star!

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike

Thanks for the star - running out of ideas as to where to look next!

Sammybobo

This may be stating the obvious, but have you considered using Internet Explorer as a means of displaying pdf files as opposed to a VFP form?

FI
Code:
[COLOR=blue]oIE = CreateObject([InternetExplorer.Application])
oIE.Navigate2([C:\temp\myfile.pdf])
oIE.Visible = .T.[/color]
If you want to remove the Internet Explorer menubar, addressbar and toolbar use
Code:
[COLOR=blue]oIE.MenuBar = .F.
oIE.AddressBar = .F.
oIE.ToolBar = .F.[/color]
Adobe Reader will interact with your Internet Explorer object correctly and not cause the displayed pdf to vanish.

If you leave the InternetExplorer object as is, navigating through the address combo to another pdf file on your hard disk will launch it as a separate instance in its own window, with the InternetExplorer object taking on the role of Windows Explorer.

If you programmatically navigate to another pdf, the pdf will show in the parent window and you can take advantage of the InternetExplorer object's history to progress backwards and forwards through the pdfs your app has opened.

See the Internet Explorer Object model for more details.

FAQ184-2483 - answering getting answered.​
Chris [pc2]
PDFcommandertm.com
PDFcommandertm.co.uk


 
Chris said:
Adobe Reader will interact with your Internet Explorer object correctly and not cause the displayed pdf to vanish.
Apologies - I forgot this particular machine has the full Acrobat installed in which case the statement is correct.


If only the Adobe Reader is installed, Adobe Reader will advise
Code:
One or more PDF documents are open inside a web browser. If you exit Adobe Reader now, those documents will be closed. Are you sure you want to exit?


FAQ184-2483 - answering getting answered.​
Chris [pc2]
PDFcommandertm.com
PDFcommandertm.co.uk


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top