Jay6395558
Posts: 0
Joined: Thu Nov 07, 2013 8:17 pm

Open pdfs from database in Adnroid

I have recently published our app for both the iphone and android phones. I have a number of buttons linked to open pdfs from the database and everything works great on the iphone. However, the Android looks like it has done the operation of opening them up but all you see is a white screen. This is the javascript I am using to access the pdf.

codewindow.open('https://api.appery.io/rest/1/db/files/527be05fe4b0157abfe953f4/72dfba43-c860-46b6-b86b-1d2f64b38531.MI-15_Family_of_Standard_Gain_Dipoles.pdf', '_blank','EnableViewPortScale=yes');/code

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Open pdfs from database in Adnroid

Hello Jay,

Please take a look at this link: http://stackoverflow.com/questions/18...

Jay6395558
Posts: 0
Joined: Thu Nov 07, 2013 8:17 pm

Open pdfs from database in Adnroid

So, the final comment in the thread you shared stated they solved the problem with the below code. Can you advise where I need to include this code?

"I have solved this problem by using following code.. first check the url string last three characters if these are pdf use if condition otherwise use else condition.where WebUrl is the url you want to open. this solution works for all Android versions(Tested on API 9 to 4.1)."

codeif(checkPDF === 'pdf') { window.plugins.childBrowser.showWebPage('http://docs.google.com/viewer?url='+WebUrl+''); } else { window.plugins.childBrowser.showWebPage(WebUrl); }/code

Dave Troxel
Posts: 0
Joined: Fri May 09, 2014 1:07 pm

Open pdfs from database in Adnroid

Hey Jay,
Any thoughts on how to GENERATE the pdf from a database table?

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Open pdfs from database in Adnroid

Jay,

This article in our forum helps you: https://getsatisfaction.com/apperyio/...

Jay6395558
Posts: 0
Joined: Thu Nov 07, 2013 8:17 pm

Open pdfs from database in Adnroid

Evgene,

You didn't really read my question did you? I need to know where to put this code in my app. Do I need to insert it as a javascript action for the tapping of every button that opens a pdf from the database? Or should it be an action for page load? Please be specific for where I should put the code Maryna suggested in the thread you provided.

Jay6395558
Posts: 0
Joined: Thu Nov 07, 2013 8:17 pm

Open pdfs from database in Adnroid

Dave,

Not really sure what you are asking. I am a bit of a novice in building apps. I've only built one. The pdfs I am linking to are contained in the Appery database. I'm not sure what you mean by a table. Sorry.

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

Open pdfs from database in Adnroid

Hello Jay,

The simplest way is to put this code on button click event. But we couldn't tell you where exactly you should put this code, because we don't know your app logic. You can use any javascript event handlers to invoke this code.

Jay6395558
Posts: 0
Joined: Thu Nov 07, 2013 8:17 pm

Open pdfs from database in Adnroid

Igor,

Thanks. Right now, I have another code that runs on button click to open the pdf. It is...

codewindow.open('https://api.appery.io/rest/1/db/files/527be05fe4b0157abfe953f4/72dfba43-c860-46b6-b86b-1d2f64b38531.MI-15_Family_of_Standard_Gain_Dipoles.pdf', '_blank','EnableViewPortScale=yes');/code

Should I put the other code before or after this code? Can I put it in the same event or do they have to be two separate events?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Open pdfs from database in Adnroid

Hi Jay,

Add the code as you need (in the same handler or not), in the order you want, due to your app logic.

Return to “Issues”