Opening PDFs on a iPad

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

Hi,

Adobe has released a free PDF reader for the iPad, iPhone and iPod Touch. You can find it here: ‎Adobe Acrobat Reader: Edit PDF on the App Store

wvitpr:
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.

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?

wvitpr:
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

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

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

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

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…

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?

application.output(fileName)
plugins.file.writeFile(fileName, plugins.file.readFile(fileName), "application/pdf")

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.

The following works for me on iPad using web client:

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');
    }
}

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

6.0.6

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?

Case: SVY-6214.