Subject Re: PDF file display
From Mervyn Bick <invalid@invalid.invalid>
Date Sat, 26 Jun 2021 11:56:43 +0200
Newsgroups dbase.getting-started
Attachment(s) dBASE_License.wfm

On 2021/06/26 10:56, Mustansir Ghor wrote:
> Dear ALL
>
> I wish to display a PDF file having 10-15pages document in a similar fashion as picture object that being displayed with image object.
>
>
> Can anybody help me to guide how this can be achieved.

To display a .pdf file in a form you need to use an ActiveX control.
Some, but not all, PDF readers do supply an ActiveX control which you
can use.  I believe older versions of Adobe Reader did but newer
versions don't.  I use the Foxit ActiveX for my own forms.

The problem with using an ActiveX control is that there must be a copy
on any computer that your form runs on.  Fortunately the
MicrosoftWebBrowser ActiveX control will also display .pdf files and
there is almost certain to be a copy on Windows machines.

With a form open in the designer select "Set up ActiveX components" from
the File menu.  This will show you all the ActiveX components registered
on your computer.  Find MicrosoftWebBrowser and select it.  This will
make it available in the ActiveX tab on the Components Palette.

You tell the ActiveX control which file to open by specifying it in the
control's nativeObject NAVGATE2() method.

A little example is attached.  I've used the dBASE Licence PDF.  You may
need to change the path on your computer.  You can, of course, simply
change the reference to any .pdf file

The preference on my computer is for the browser to use Foxit to open
.pdf files so the example may work a bit differently on your computer.
On mine right-clicking pops up a menu with various options.  You will
just have to experiment a bit.

Mervyn.




** END HEADER -- do not remove this line
//
// Generated on 2021-06-26
//
parameter bModal
local f
f = new dBASE_LicenseForm()
if (bModal)
   f.mdi = false // ensure not MDI
   f.readModal()
else
   f.open()
endif

class dBASE_LicenseForm of FORM
   with (this)
      onOpen = class::FORM_ONOPEN
      height = 22.0
      left = 32.1429
      top = 0.0
      width = 129.0
      text = ""
   endwith

   this.MICROSOFTWEBBROWSER1 = new ACTIVEX(this)
   with (this.MICROSOFTWEBBROWSER1)
      height = 20.4091
      left = 3.2857
      top = 1.0
      width = 123.0
      l0 = "FNBBBBBBKEGJBBBBQPDOBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBFNBBBBBBBBBBBBBBBBBBBBBBBCBBBBBBPBOBGIBBIEEGNQCCLPHKBJBBDMDPCDHDBJBBBBBBBBBBBBBBFNBBBBBBBCCFBDBBBBBBBBBBNBBBBBBBBBBBBBFHJBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"
      l0 += "BBBBBBBBBBBBBBBBBCBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"
      state = l0
      classId = "{8856F961-340A-11D0-A96B-00C04FD705A2}"
   endwith


   function form_onOpen()
      form.microsoftwebbrowser1.nativeobject.navigate2("C:\Program Files (x86)\dBASE\dBASE2019\Licenses\dBASE_2019_License.pdf")
      return

endclass