Page 1 of 3
Open pdfs from database in Adnroid
Posted: Tue May 27, 2014 5:24 pm
by Jay6395558
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
Open pdfs from database in Adnroid
Posted: Tue May 27, 2014 5:50 pm
by Evgene Karachevtsev
Hello Jay,
Please take a look at this link: http://stackoverflow.com/questions/18...
Open pdfs from database in Adnroid
Posted: Wed May 28, 2014 4:19 pm
by Jay6395558
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
Open pdfs from database in Adnroid
Posted: Wed May 28, 2014 5:57 pm
by Dave Troxel
Hey Jay,
Any thoughts on how to GENERATE the pdf from a database table?
Open pdfs from database in Adnroid
Posted: Wed May 28, 2014 6:47 pm
by Evgene Karachevtsev
Jay,
This article in our forum helps you: https://getsatisfaction.com/apperyio/...
Open pdfs from database in Adnroid
Posted: Wed May 28, 2014 7:44 pm
by Jay6395558
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.
Open pdfs from database in Adnroid
Posted: Wed May 28, 2014 7:46 pm
by Jay6395558
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.
Open pdfs from database in Adnroid
Posted: Wed May 28, 2014 10:50 pm
by Igor
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.
Open pdfs from database in Adnroid
Posted: Wed May 28, 2014 11:43 pm
by Jay6395558
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?
Open pdfs from database in Adnroid
Posted: Thu May 29, 2014 10:44 am
by Kateryna Grynko
Hi Jay,
Add the code as you need (in the same handler or not), in the order you want, due to your app logic.