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