Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sat Nov 18, 2017 1:21 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 15 posts ] 
Author Message
 Post subject: Viewing PDF files
PostPosted: Wed May 29, 2013 8:14 am 
Offline

Joined: Wed Jan 09, 2013 5:53 am
Posts: 25
Hi All

I have a fudge to read PDF files in a real studio project. Essentially I am using the HTMLviewer and reading in an .htm file which itself embeds a pdf. The .htm file has the following html statement (call it help.htm for instance)

<object type="application/pdf" data="G:\sample.pdf" " width="90%" height="90%" < >/object >

Then I use a simple htmlviewer.loadurl "G:\help.htm" statement in the open event.


This works just fine and does the job I want with IE/Chrome et al (except Safari). Not hugely elegant I admit but ok. I am working with Win7 and have all the normal browsers installed. My question is - How does the HTMLViewer work exactly?, Is it dependant on/linked to a particular browser? or is it truly standalone code? The reason for asking is that my "trick" does not work with Safari, though safari happily opens pdfs from the interent, so would the fudge work in the app running on a MAC if HTMLViewer were dependent on safari? If the answer is no can anyone tell me how to embed a pdf into safari?. Hope this makes sense

Thanks


Top
 Profile  
Reply with quote  
 Post subject: Re: Viewing PDF files
PostPosted: Wed May 29, 2013 8:38 am 
Offline
User avatar

Joined: Tue Jan 04, 2011 3:02 am
Posts: 1236
Location: Jönköping, Sweden
It's a Web App right?

_________________
Image http://www.linkedin.com/in/albinkiland
Dev. iMac 27" + 2x22" LG (2.8GHz Intel Core i7, 12GB RAM, 120GB SSD) OS X 10.8
Xojo Pro 2013r1


Top
 Profile  
Reply with quote  
 Post subject: Re: Viewing PDF files
PostPosted: Wed May 29, 2013 8:54 am 
Offline

Joined: Wed Jan 09, 2013 5:53 am
Posts: 25
Hi - thanks for the reply...

Actually no this is a desktop app. The appp writes the .htm file internally, then creates it, and deletes it on closing down app. User picks which pdf to view


Top
 Profile  
Reply with quote  
 Post subject: Re: Viewing PDF files
PostPosted: Wed May 29, 2013 9:49 am 
Offline
User avatar

Joined: Sun Aug 05, 2007 10:46 am
Posts: 4931
Location: San Diego, CA
If all you want to do is view the PDF .. .use the LAUNCH feature of folderitem

that is if you don't need/or care that is displayed in an external window

_________________
Dave Sisemore
iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1
Note : I am not interested in any solutions that involve custom Plug-ins of any kind


Top
 Profile  
Reply with quote  
 Post subject: Re: Viewing PDF files
PostPosted: Wed May 29, 2013 10:10 am 
Offline

Joined: Wed Jan 09, 2013 5:53 am
Posts: 25
Hi dave - thanks for the suggestion. I was using that method and, as you say, it works just fine. However, again as you note, I wanted the pdf displayed in the same window which rather scuppered that method as far as I could tell. Also it assumes a reader is installed like acrobat. So I guess, the question is still would this method (as ugly as it seems) work with a MAC...

not being a MAC user I can't tell

Thanks again


Top
 Profile  
Reply with quote  
 Post subject: Re: Viewing PDF files
PostPosted: Wed May 29, 2013 10:11 am 
Offline
User avatar

Joined: Sun Aug 05, 2007 10:46 am
Posts: 4931
Location: San Diego, CA
Yes it works just fine with a MAC

OSX has PDF support built in so no need to worry about 3rd party apps.

_________________
Dave Sisemore
iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1
Note : I am not interested in any solutions that involve custom Plug-ins of any kind


Top
 Profile  
Reply with quote  
 Post subject: Re: Viewing PDF files
PostPosted: Wed May 29, 2013 11:31 am 
Offline

Joined: Wed Jan 09, 2013 5:53 am
Posts: 25
thanks for that Dave

much appreciated


Top
 Profile  
Reply with quote  
 Post subject: Re: Viewing PDF files
PostPosted: Wed May 29, 2013 1:07 pm 
Offline

Joined: Wed Mar 22, 2006 11:15 am
Posts: 712
Location: Southern California
This has me curious because I tried the same trick and could view PDFs in the HTMLViewer on Windows with no problems. But on Mac OS X it crashes. Do you experience the same?

It shouldn't be crashing. WebKit should be able to render PDFs on Mac OS. Perhaps a Feedback is in order?

_________________
Daniel L. Taylor
Custom Controls for Real Studio WE!
Visit: http://www.webcustomcontrols.com/


Top
 Profile  
Reply with quote  
 Post subject: Re: Viewing PDF files
PostPosted: Thu May 30, 2013 6:55 am 
Offline

Joined: Wed Jan 09, 2013 5:53 am
Posts: 25
taylor-design wrote:
This has me curious because I tried the same trick and could view PDFs in the HTMLViewer on Windows with no problems. But on Mac OS X it crashes. Do you experience the same?

It shouldn't be crashing. WebKit should be able to render PDFs on Mac OS. Perhaps a Feedback is in order?




you've got me concerned now!!...

If it works for windows but NOT for a Mac then it is not really a solution.

Can someone try it for me, it is only a couple of lines of code

Using notepad or Mac equivalent you'd type (rough and ready):

<Html>
<object type="application/pdf" data="C:\sample.pdf" " width="90%" height="90%" < >/object >
</html>

save as "anything you want".htm
have a pdf called sample on c: or equivalent then open "anything you want".htm in safari on a MAC platform...

pretty please!!


Top
 Profile  
Reply with quote  
 Post subject: Re: Viewing PDF files
PostPosted: Thu May 30, 2013 8:31 am 
Offline

Joined: Tue Apr 17, 2007 9:19 pm
Posts: 437
We have a cross platform app that provides the ability to view the PDF and on the Windows platform, we auto install with our app the Sumatra.pdf viewer (free). Even though most browsers can typically view PDF files and most users have Adobe installed, we opted to provide the option to use Sumatra (we auto install it and let them use a preference option to select it) because it has a much smaller footprint than Adobe (especially Acrobat) and loads very quickly.

On the Mac side of things, we just use Preview, which is the default Mac app for viewing PDF files.

One of the advantages of using an external app for viewing PDF files is the flexibility of viewing multiple PDF files, zooming, printing, etc. We considered an internal viewer and decided the benefits of an external viewer could not be offset with an internal viewer no matter how hard we worked.

I might as well put in a plug for DynaPDF by Monkeybread that has turned into our goto report generator. Fast, flexible, and 100% cross platform reliable ... but there is a learning curve.


Top
 Profile  
Reply with quote  
 Post subject: Re: Viewing PDF files
PostPosted: Thu May 30, 2013 10:59 am 
Offline

Joined: Wed Mar 22, 2006 11:15 am
Posts: 712
Location: Southern California
ngmp wrote:
save as "anything you want".htm
have a pdf called sample on c: or equivalent then open "anything you want".htm in safari on a MAC platform...


Here's something I find confusing in your posts...

You mention using HTMLViewer which is a control in RB. But you also mention testing different browsers, implying that you are opening the .htm file in the browser.

If all you are doing is opening the file (i.e. Launch), then it will work and open in the user's default browser.

If you are using HTMLViewer, then you need to check on Mac because HTMLViewer seems to be choking on PDFs. (Although it could certainly be something I'm doing wrong.)

HTMLViewer has a Renderer option with two choices: Native and WebKit. On Mac it doesn't matter, it always uses WebKit. On Windows Native = the built in IE engine.

_________________
Daniel L. Taylor
Custom Controls for Real Studio WE!
Visit: http://www.webcustomcontrols.com/


Top
 Profile  
Reply with quote  
 Post subject: Re: Viewing PDF files
PostPosted: Thu May 30, 2013 11:18 am 
Offline

Joined: Wed Jan 09, 2013 5:53 am
Posts: 25
taylor-design wrote:
ngmp wrote:
save as "anything you want".htm
have a pdf called sample on c: or equivalent then open "anything you want".htm in safari on a MAC platform...


Here's something I find confusing in your posts...

You mention using HTMLViewer which is a control in RB. But you also mention testing different browsers, implying that you are opening the .htm file in the browser.

If all you are doing is opening the file (i.e. Launch), then it will work and open in the user's default browser.

If you are using HTMLViewer, then you need to check on Mac because HTMLViewer seems to be choking on PDFs. (Although it could certainly be something I'm doing wrong.)

HTMLViewer has a Renderer option with two choices: Native and WebKit. On Mac it doesn't matter, it always uses WebKit. On Windows Native = the built in IE engine.


You're right...

I want to open a pdf (in the same window as it is called from not an external window). I write my .htm file for loading into the htmlviewer and everything works fine. I see the pdf etc. However I only have access to a windows platform so I opened the .htm file in some browsers to check if they all worked ok like on the htmlviewer. All did with the exception of safari. So as safari is apple, I wondered if (as I do not have accesss to MAC OS) if the "trick" would work in a MAC environment? Running the .htm in safari is the closest I can get to "applelike" environments. It did not work so I wondered if Htmlviewer is linked to any particular browser technology etc.

From what you're saying the "trick" will not work on a MAC and this was in conflict with what DaveS implied. No offence intended to anyone. The fact still remains I don't want a new window opening when viewing the pdf. That's all. Works fine on my windows desktop but will it work on a MAC.


Top
 Profile  
Reply with quote  
 Post subject: Re: Viewing PDF files
PostPosted: Thu May 30, 2013 11:50 am 
Offline
User avatar

Joined: Tue Jan 04, 2011 3:02 am
Posts: 1236
Location: Jönköping, Sweden
This code in an HTML document works for me on my mac in Chrome and Safari.
The PDF is on my main drive called "iMac i7 SSD"
Quote:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Namnlöst dokument</title>
</head>
<object data="file://iMac%20i7%20SSD/test.pdf" type="application/pdf" width="100%" height="700px">
<p>Your web browser doesn't have a PDF plugin.
Instead you can <a href="file://iMac%20i7%20SSD/test.pdf">click here to
download the PDF file.</a></p>
</object>
<body>
</body>
</html>

I might be way off with what you're asking but it's worth a shot :)

_________________
Image http://www.linkedin.com/in/albinkiland
Dev. iMac 27" + 2x22" LG (2.8GHz Intel Core i7, 12GB RAM, 120GB SSD) OS X 10.8
Xojo Pro 2013r1


Top
 Profile  
Reply with quote  
 Post subject: Re: Viewing PDF files
PostPosted: Thu May 30, 2013 12:33 pm 
Offline

Joined: Wed Mar 22, 2006 11:15 am
Posts: 712
Location: Southern California
ngmp wrote:
I want to open a pdf (in the same window as it is called from not an external window)....From what you're saying the "trick" will not work on a MAC and this was in conflict with what DaveS implied. No offence intended to anyone. The fact still remains I don't want a new window opening when viewing the pdf. That's all. Works fine on my windows desktop but will it work on a MAC.


If I write the text to disk and open the file in Safari, it works and the PDF is displayed.

If I try to load the file into an HTMLViewer, it crashes using both Carbon and Cocoa.

_________________
Daniel L. Taylor
Custom Controls for Real Studio WE!
Visit: http://www.webcustomcontrols.com/


Top
 Profile  
Reply with quote  
 Post subject: Re: Viewing PDF files
PostPosted: Thu May 30, 2013 2:11 pm 
Offline

Joined: Wed Jan 09, 2013 5:53 am
Posts: 25
Many thanks guys for helping me out...

wonder why htmlviewer bombs on the MAC? Oh well!

thanks again


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group