Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Viewing PDF In IE Control
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01312276
Message ID:
01312530
Views:
26
This worked as expected. The Toolbar and Pages pane are off.

I'll examine this more. Thanks!




>Below is the code that works for me. Can you run it "as is" and let me know result?
>
>PUBLIC oform1
>
>oForm1=NEWOBJECT("form1")
>oForm1.Show()
>RETURN
>
>DEFINE CLASS form1 AS form
>
>	Autocenter = .T.
>	Height = 520
>	Width = 741
>	Caption = "Form1"
>	Name = "Form1"
>	cPdfFileName = "=SPACE(0)"
>
>	ADD OBJECT txtpdfname AS textbox WITH ;
>		Top = 471, Left = 108, Height = 23, Width = 492, ;
>		ReadOnly = .T., Name = "txtPdfName"
>
>	ADD OBJECT command1 AS commandbutton WITH ;
>		Top = 469, Left = 623, Height = 27, Width = 84, ;
>		Caption = "View PDF", Name = "Command1"
>
>	ADD OBJECT owb AS olecontrol WITH ;
>		Top = 24, Left = 12, Height = 433, Width = 709, ;
>		OleClass = "Shell.Explorer.2", Name = "oWB"
>
>	ADD OBJECT label1 AS label WITH ;
>		Height = 17, Left = 36, Top = 474, Width = 63, ;
>		Caption = "PDF Name", Name = "Label1"
>
>	PROCEDURE Refresh
>		* Required in VFP8 and earlier to prevent an error
>		NODEFAULT
>	ENDPROC
>
>	PROCEDURE ShowPdf
>		* Clear Web browser control by loading blank page
>		Thisform.oWB.OBJECT.Navigate2("About:Blank")
>		* Wait for load to complete
>		lnSeconds = SECONDS()
>		DO WHILE (Thisform.oWB.OBJECT.Busy OR Thisform.oWB.OBJECT.ReadyState <> 4) ;
>				AND SECONDS() - lnSeconds < 60
>			DOEVENTS
>		ENDDO
>
>		* Load PDF
>		Thisform.oWB.OBJECT.Navigate2(Thisform.cPdfFileName)
>		* Wait for load to complete
>		lnSeconds = SECONDS()
>		DO WHILE (Thisform.oWB.OBJECT.Busy OR Thisform.oWB.OBJECT.ReadyState <> 4) ;
>				AND SECONDS() - lnSeconds < 60
>			DOEVENTS
>		ENDDO
>
>		TRY
>			loDoc = Thisform.oWB.oBJECT.Document
>			= loDoc.setPageMode("Page Only")
>			= loDoc.setShowToolbar(0)
>		FINALLY 	
>			loDoc = null
>		ENDTRY	
>
>	ENDPROC
>
>	PROCEDURE command1.Click
>		* Get PDF file name
>		Thisform.cPdfFileName = GETFILE("pdf")
>		* Display the name in the textbox
>		Thisform.txtPdfName.Value = Thisform.cPdfFileName
>		IF NOT EMPTY(Thisform.cPdfFileName)
>			* Display PDF
>			Thisform.ShowPdf()
>		ENDIF
>	ENDPROC
>
>ENDDEFINE
>
>
>The problem is that PDF has to load completely before you can apply those changes.
>
>>The code is exact. Again, if I walk it through, all is ok. When I let it run, the pages and toolbars don't hide.
>>
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform