Opening PDFs on a iPad

Forum to discuss the Web client version of Servoy.

Opening PDFs on a iPad

Postby wvitpr » Wed Jul 11, 2012 3:48 pm

Hello,
I have built a simple document management solution for use on WC, I was hoping that I could also use it on a iPad, should this be possible ? The file type is PDF so I felt it would be safe to assume that the iPad would know how to handle it natively but it does not work.. :-( , it does not even try to open the doc..
Any help would be greatly appreciated
User avatar
wvitpr
 
Posts: 219
Joined: Tue Apr 24, 2007 1:38 am

Re: Opening PDFs on a iPad

Postby omar » Wed Jul 11, 2012 3:55 pm

Hi,

Adobe has released a free PDF reader for the iPad, iPhone and iPod Touch. You can find it here: http://itunes.apple.com/us/app/adobe-reader/id469337564
Intrasoft, Founder
Omar van Galen
omar@intrasoft.nl
+31-(0)6-21234586
Servoy Developer
omar
 
Posts: 377
Joined: Sat Feb 12, 2011 4:51 pm
Location: Intrasoft, The Netherlands

Re: Opening PDFs on a iPad

Postby Jan Aleman » Wed Jul 11, 2012 4:39 pm

wvitpr wrote:Hello,
I have built a simple document management solution for use on WC, I was hoping that I could also use it on a iPad, should this be possible ? The file type is PDF so I felt it would be safe to assume that the iPad would know how to handle it natively but it does not work.. :-( , it does not even try to open the doc..
Any help would be greatly appreciated


Make sure to use this line of code:

plugins.file.writeFile('thepdf.pdf', theblobthatisthepdf , "application/pdf")

the above works on both my ipad and iphone without any Adobe programs on it.
Jan Aleman
Servoy
Jan Aleman
 
Posts: 2083
Joined: Wed Apr 23, 2003 9:49 pm
Location: Planet Earth

Re: Opening PDFs on a iPad

Postby wvitpr » Wed Jul 11, 2012 5:53 pm

Hello Jan,
You make reference to "theblobthatisthepdf", does this mean the file must be in a blob feild ?, or can I stream from a folder on the server?
Regards,
Phillip Routley

Worldview IT
Sydney, Australia
User avatar
wvitpr
 
Posts: 219
Joined: Tue Apr 24, 2007 1:38 am

Re: Opening PDFs on a iPad

Postby Jan Aleman » Wed Jul 11, 2012 6:20 pm

wvitpr wrote:Hello Jan,
You make reference to "theblobthatisthepdf", does this mean the file must be in a blob feild ?, or can I stream from a folder on the server?


can be both
Jan Aleman
Servoy
Jan Aleman
 
Posts: 2083
Joined: Wed Apr 23, 2003 9:49 pm
Location: Planet Earth

Re: Opening PDFs on a iPad

Postby wvitpr » Wed Jul 11, 2012 6:23 pm

I just tried a blob field and it works, thanks.. but no luck with

Code: Select all
plugins.file.writeFile(fileName, plugins.file.readFile(plugins.file.convertToRemoteJSFile(rec.file_name)), "application/pdf")


It seems the plugins.file.convertToRemoteJSFile(rec.file_name) returns null, but the file exists
Regards,
Phillip Routley

Worldview IT
Sydney, Australia
User avatar
wvitpr
 
Posts: 219
Joined: Tue Apr 24, 2007 1:38 am

Re: Opening PDFs on a iPad

Postby Jan Aleman » Wed Jul 11, 2012 6:29 pm

wvitpr wrote:I just tried a blob field and it works, thanks.. but no luck with

Code: Select all
plugins.file.writeFile(fileName, plugins.file.readFile(plugins.file.convertToRemoteJSFile(rec.file_name)), "application/pdf")


It seems the plugins.file.convertToRemoteJSFile(rec.file_name) returns null, but the file exists


I'm not an expert but I'd use a plain vanilla readFile. Web-client runs on the server....
Jan Aleman
Servoy
Jan Aleman
 
Posts: 2083
Joined: Wed Apr 23, 2003 9:49 pm
Location: Planet Earth

Re: Opening PDFs on a iPad

Postby wvitpr » Wed Jul 11, 2012 6:40 pm

I just tried this, the output returns 60beam.pdf which is the correct file name and I get a "Open File" dialog popup which must be coming from Developer ???, and not on the ipad which is strange. Should I be able to test this from developer?

Code: Select all
application.output(fileName)
plugins.file.writeFile(fileName, plugins.file.readFile(fileName), "application/pdf")
Regards,
Phillip Routley

Worldview IT
Sydney, Australia
User avatar
wvitpr
 
Posts: 219
Joined: Tue Apr 24, 2007 1:38 am

Re: Opening PDFs on a iPad

Postby Jan Aleman » Wed Jul 11, 2012 6:52 pm

For me this works:

var thepdf = plugins.file.readFile('/misc/tmp/apdf.pdf');
plugins.file.writeFile('apdf.pdf', thepdf , "application/pdf")

In your case you are using fileName in quite an interesting way.
Jan Aleman
Servoy
Jan Aleman
 
Posts: 2083
Joined: Wed Apr 23, 2003 9:49 pm
Location: Planet Earth

Re: Opening PDFs on a iPad

Postby AlanBourke » Wed Jul 11, 2012 9:48 pm

The following works for me on iPad using web client:

Code: Select all
function downloadMandate()
{
    // -- 'globals.appSettings.miscfiles' refers to a location on the Servoy Application Server.
    var attachmentFile = plugins.file.convertToJSFile(globals.appSettings.miscfiles + '//ddmandate.pdf');

    if (attachmentFile.exists())
    {
        var fbytes = plugins.file.readFile(attachmentFile);
        var nothing = plugins.file.writeFile('ddmandate.pdf', fbytes, 'application/pdf');
    }
}
-------------------------------------------------------------------------------------------
Servoy SAN Developer
User avatar
AlanBourke
 
Posts: 198
Joined: Tue Aug 02, 2011 3:32 pm
Location: Dublin, Ireland

Re: Opening PDFs on a iPad

Postby wvitpr » Thu Jul 12, 2012 7:20 am

Hi Alan,
Could I ask what version of servoy you are using?
Regards,
Phillip Routley

Worldview IT
Sydney, Australia
User avatar
wvitpr
 
Posts: 219
Joined: Tue Apr 24, 2007 1:38 am

Re: Opening PDFs on a iPad

Postby AlanBourke » Thu Jul 12, 2012 9:55 am

6.0.6
-------------------------------------------------------------------------------------------
Servoy SAN Developer
User avatar
AlanBourke
 
Posts: 198
Joined: Tue Aug 02, 2011 3:32 pm
Location: Dublin, Ireland

Re: Opening PDFs on a iPad

Postby engemann » Mon Mar 10, 2014 3:05 pm

plugins.file.writeFile('filename.pdf', fbytes, 'application/pdf');

It doesn't work with 7.4rc on my Ipad (iOS 7).
It is a bug in 7.4rc or in iOS7?
engemann
 
Posts: 4
Joined: Mon Mar 18, 2013 12:40 pm

Re: Opening PDFs on a iPad

Postby Andrei Costescu » Fri Mar 21, 2014 11:30 am

Case: SVY-6214.
Andrei Costescu
Servoy
Andrei Costescu
 
Posts: 1018
Joined: Tue Jun 26, 2007 3:14 pm


Return to Servoy Web Client

Who is online

Users browsing this forum: No registered users and 9 guests