Using the Web*Gadget as a pdf viewer.

Everything else that doesn't fall into one of the other PB categories.
Axolotl
Addict
Addict
Posts: 837
Joined: Wed Dec 31, 2008 3:36 pm

Using the Web*Gadget as a pdf viewer.

Post 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
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
normeus
Enthusiast
Enthusiast
Posts: 472
Joined: Fri Apr 20, 2012 8:09 pm
Contact:

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

Post 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
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari
Axolotl
Addict
Addict
Posts: 837
Joined: Wed Dec 31, 2008 3:36 pm

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

Post 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?
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
normeus
Enthusiast
Enthusiast
Posts: 472
Joined: Fri Apr 20, 2012 8:09 pm
Contact:

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

Post 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.
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari
Axolotl
Addict
Addict
Posts: 837
Joined: Wed Dec 31, 2008 3:36 pm

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

Post 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.
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
Post Reply