Is it possible to use PB-webgadget as a pdf-viewer?
How to open pdf-file in this gadget?
			
			
									
									
						Webgadget as pdf-viewer?
Re: Webgadget as pdf-viewer?
Code: Select all
  Procedure NavigationCallback(Gadget, Url$) 
    If Url$= "http://www.purebasic.com/news.php" 
      MessageRequester("", "No news today!") 
      ProcedureReturn #False 
    Else 
      ProcedureReturn #True 
    EndIf 
  EndProcedure 
  
  If OpenWindow(0, 0, 0, 600, 300, "WebGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) 
    WebGadget(0, 10, 10, 580, 280, "http://asw.gmxhome.de/PureBasicBuch.pdf") 
    SetGadgetAttribute(0, #PB_Web_NavigationCallback, @NavigationCallback())
    Repeat 
    Until WaitWindowEvent() = #PB_Event_CloseWindow 
  EndIf
sorry for my bad english
						- 
				MachineCode
 - Addict

 - Posts: 1482
 - Joined: Tue Feb 22, 2011 1:16 pm
 
Re: Webgadget as pdf-viewer?
@Josh: That's unreliable. It opens in a PDF viewer on my PC, instead of in the browser. That's because people have different ways of default-viewing PDFs.
			
			
									
									Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
						PureBasic: Born in 1998 and still going strong to this very day!
Re: Webgadget as pdf-viewer?
Keep in mind the way it will work depend on the user's settings.
For example I don't like PDFs to be opened inside the browser, and I set it to launch the PDF viewer instead.
So the code above in my case open the PDF outside the browser.
EDIT: too late.
			
			
									
									For example I don't like PDFs to be opened inside the browser, and I set it to launch the PDF viewer instead.
So the code above in my case open the PDF outside the browser.
EDIT: too late.
"Have you tried turning it off and on again ?"
						Re: Webgadget as pdf-viewer?
Thank you guys.
On my computer I disabled IE and use Firefox as browser and Foxit as pdf-reader.
When I execute Josh's code then I get a pdf-viewer inside the webgadget.
But I agree Luis to launch a viewer outside the gadget.
Anyway I shall continue with experimenting the interesting webgadget.
			
			
									
									
						On my computer I disabled IE and use Firefox as browser and Foxit as pdf-reader.
When I execute Josh's code then I get a pdf-viewer inside the webgadget.
But I agree Luis to launch a viewer outside the gadget.
Anyway I shall continue with experimenting the interesting webgadget.
- 
				Little John
 - Addict

 - Posts: 4807
 - Joined: Thu Jun 07, 2007 3:25 pm
 - Location: Berlin, Germany
 
Re: Webgadget as pdf-viewer?
Since the current Firefox version has a built-in PDF viewer, it should work fine even without any additional program, I think.Hadrian wrote:On my computer I disabled IE and use Firefox as browser and Foxit as pdf-reader.
When I execute Josh's code then I get a pdf-viewer inside the webgadget.
- 
				MachineCode
 - Addict

 - Posts: 1482
 - Joined: Tue Feb 22, 2011 1:16 pm
 
Re: Webgadget as pdf-viewer?
Which would be fine if Firefox were the only browser in existence. But what about IE, Chrome, Safari, Opera, and so on?Little John wrote:Since the current Firefox version has a built-in PDF viewer, it should work fine even without any additional program, I think.
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
						PureBasic: Born in 1998 and still going strong to this very day!
- 
				Little John
 - Addict

 - Posts: 4807
 - Joined: Thu Jun 07, 2007 3:25 pm
 - Location: Berlin, Germany
 
Re: Webgadget as pdf-viewer?
MachineCode wrote:But what about IE, Chrome, Safari, Opera, and so on?
I quoted Hadrian's post, and just refered to what happens on his computer.Little John wrote:Since the current Firefox version has a built-in PDF viewer, it should work fine even without any additional program, I think.Hadrian wrote:On my computer I disabled IE and use Firefox as browser and Foxit as pdf-reader.
When I execute Josh's code then I get a pdf-viewer inside the webgadget.
- 
				MachineCode
 - Addict

 - Posts: 1482
 - Joined: Tue Feb 22, 2011 1:16 pm
 
Re: Webgadget as pdf-viewer?
So you did. I overlooked that fact. Sorry.
			
			
									
									Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
						PureBasic: Born in 1998 and still going strong to this very day!
