Page 1 of 1

Using the Web*Gadget as a pdf viewer.

Posted: Sun Nov 24, 2024 5:00 pm
by Axolotl
HI there,

today I found out more or less by accident that you can easily build a pdf viewer with the help of the Web*Gadget's. (see example)
Interestingly, all three variants work.
Now I wonder what is behind it.
And of course: Which is the best way?
Any advice or help would be appreciated.
TIA.

BTW: With a quick check I figured out that there are different components 'Chrome' or 'Acrobat' involved.

Code: Select all

; Variant WebViewGadget() 
; PID: ?  Wnd: ?  WT: ""  ?  CN: "PureWebView"
; PID: ?  Wnd: ?  WT: ""  ?  CN: "Chrome_WidgetWin_0"
; PID: ?  Wnd: ?  WT: "Kuenstliche_Intelligenz.pdf"  ?  CN: "Chrome_WidgetWin_1"

; Variant WebGadget() 
; PID: ?  Wnd: ?  WT: "Web"  ?  CN: "PureWeb"
; ....
; PID: ?  Wnd: ?  WT: "C:\Temp\Kuenstliche_Intelligenz.pdf - Adobe Acrobat Reader (64-bit)"  ?  CN: "Static"

; Variant WebGadget("", #PB_Web_Edge) 
; PID: ?  Wnd: ?  WT: ""  ?  CN: "PureWebView"
; PID: ?  Wnd: ?  WT: ""  ?  CN: "Chrome_WidgetWin_0"
; PID: ?  Wnd: ?  WT: "Kuenstliche_Intelligenz.pdf"  ?  CN: "Chrome_WidgetWin_1"

Code: Select all

#ChooseTheWebGadget = 1 
; #ChooseTheWebGadget = 2 
; #ChooseTheWebGadget = 3 

Global url$ = "file://C:\Temp\Kuenstliche_Intelligenz.pdf"   ; <<< change this to your pdf file 

If OpenWindow(0, 0, 0, 600, 600, "WebGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CompilerSelect #ChooseTheWebGadget 
  CompilerCase 1  ;<Variant 1> 
    SetWindowTitle(0, "WebGadget Variant 1") 
    WebViewGadget(0, 10, 10, 580, 580) 
    SetGadgetText(0, url$) 

  CompilerCase 2  ;<Variant 2>
    SetWindowTitle(0, "WebGadget Variant 2") 
    WebGadget(0, 10, 10, 580, 580, url$)

  CompilerCase 3  ;<Variant 3>
    SetWindowTitle(0, "WebGadget Variant 3") 
    WebGadget(0, 10, 10, 580, 580, url$, #PB_Web_Edge) 

CompilerEndSelect 
  Repeat
  Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf

Re: Using the Web*Gadget as a pdf viewer.

Posted: Mon Nov 25, 2024 5:08 am
by normeus
option one uses the default web-browser in windows, that would be your best choice
#2 uses the default PDF viewer that has been added to your web-browser like Adobe Acrobat or PDFxpert, etc...
#3 uses the WebView2 engine which is based on chrome all newer systems should have it, but some might not

Norm

Re: Using the Web*Gadget as a pdf viewer.

Posted: Mon Nov 25, 2024 11:09 am
by Axolotl
Hi Norm,
thanks for your reply.

Just another question to be umpteen times safer: I would like to keep the data content from the PDF locally on the computer. This should be the case with these examples, right?

Re: Using the Web*Gadget as a pdf viewer.

Posted: Tue Nov 26, 2024 4:48 am
by normeus
They are NOT using the web to display the PDF.

For Adobe Acrobat, you have to make sure the setting for sending your content to help their AI engine is off. Adobe has become a horrible company when it comes to privacy.

Norm.

Re: Using the Web*Gadget as a pdf viewer.

Posted: Tue Nov 26, 2024 10:51 am
by Axolotl
Thanks for the info.
That's what I was hoping for. Unfortunately, many companies go down this route and justify it with improvement and convenience.
I wish these functions were off by default and that you had to actively activate them. I really don't trust anyone here.
But what do I know.