Vinny B
Posts: 0
Joined: Fri Aug 22, 2014 2:22 pm

open pdf from database using list

Hello

Code: Select all

I looked through the appery support and I cant find an example on how to do this.  

I have a database that contains 100 pdf files. The app generates a list with all the pdf files. 

I want to be ablwe to click on the list and it opens the pdf file.

How do I map a pdf file to a page?

What Javascript do I need to dynamically get the pdf name from the database and open it?

Code: Select all

Is there a component buiild in appery to display PDF?
Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

open pdf from database using list

Hello Vinny,

1) Please place a link to your page
2) Link to your pdf file should have masterkey
precode
curl -X GET \
https:&#47;&#47;api&#46;appery&#46;io/rest/1/db/files/54b88d61XXXXXXXXX6676d3f5e/<file_name>\
[?][encoded="base64"][&][sessionToken=<session_token>]\
[&][masterKey=<master_key>]/code/pre

If i have image "file.pdf" and master key "54545454" then url will be
pre codehttps:&#47;&#47;api&#46;appery&#46;io/rest/1/db/files/54b88d61XXXXXXXXX6676d3f5e/temp&#46;png?masterKey=54545454/code/pre

Vinny B
Posts: 0
Joined: Fri Aug 22, 2014 2:22 pm

open pdf from database using list

im sorry i dont understand. Where is Appery do I put the code?

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

open pdf from database using list

Vinny,

1) Drag and drop link component from the Palette
2) Find URL parameter

to make it manually just paste the url
http://gyazo.com/ae0ece95b135ab90187b...

to make it from list service
Map from response file name and add js code
var DB_ID = '54b88d61XXXXXXXXX6676d3f5e';
var masterKey = '54545454';
return ' https://api.appery.io/rest/1/db/files/' + DB_ID + '/' + value + '?masterKey='+masterKey;

where DB_ID and masterKey are your actual Database id and master key of you Database.

Return to “Issues”