Skip to first unread message

tiko

unread,
May 13, 2019, 1:01:38 PM5/13/19
to MIT App Inventor Forum
hello...
i have a webviewer component which shows a web page.
this page contains a links to différent files (images, pdf, text..)

1- whene i click on the link the webviewer cant show the document!!
2- how can i download the document without open it?

can you send me a simple example which can help me?
(all documentd in this forum didn't help me)

please help me.
thank you

BodyMindPower

unread,
May 13, 2019, 1:31:33 PM5/13/19
to MIT App Inventor Forum
Most of the time in this forum might be spent asking for more details (relevant blocks, aia, screenshots, ...), see also here:

tiko

unread,
May 13, 2019, 2:17:31 PM5/13/19
to MIT App Inventor Forum
here a simple example (aia project) which describs my problem ....
the webViewer component is unable to display pdf document whene i click on the link inside the php page.

- how can i show the pdf document in the webviwer?
- how can dowload it wthout open it ?

please help me.

webviewer_pdf_files.aia

BodyMindPower

unread,
May 13, 2019, 2:30:20 PM5/13/19
to MIT App Inventor Forum
as Tim said, add this:


TimAI2

unread,
May 13, 2019, 2:53:24 PM5/13/19
to MIT App Inventor Forum
Your aia project file is of no help

Unless you call the pdf files directly from AI2, you will have to change the urls to the pdfs in the php page

tiko

unread,
May 13, 2019, 3:22:51 PM5/13/19
to MIT App Inventor Forum
- that didn't help me! see the result in the attashed file! this is not what i nedd to have!
- i can't call pdf file directly from Ai2, i must use links of the php page!
- here my php page.
webviewer_pdf_files.aia
Screenshot_2019-05-13-20-17-29.png
appinventorForum.php

TimAI2

unread,
May 13, 2019, 4:57:47 PM5/13/19
to mitappinv...@googlegroups.com
You will need to supply the full path to your pdf file, a relative path will not work



I have tested this with a dummy pdf on my server and it works in a PC browser

<!DOCTYPE html>
<html>

<head>
<title>PDFViewer</title>
</head>

<body>
</body>

</html>



TimAI2

unread,
May 13, 2019, 5:04:25 PM5/13/19
to MIT App Inventor Forum
Actually, a full path to the pdf file may be enough on its own for the webviewer to display it ?

If this or the above doesn't work:
  1. Try using activityStarter and Chrome to view pdfs
  2. See Taifun's pdf extension
  3. Use the webviewstring to transfer the full path of the pdf to AI2 then call it with the google viewer in a webviewer

TimAI2

unread,
May 13, 2019, 5:41:43 PM5/13/19
to MIT App Inventor Forum
Sorry, I see now that you want to download the pdf

Use the webstringview to transfer the full path of the file, then a web component to download the file (set SaveResponse=true, then set ResponseFileName)

tiko

unread,
May 14, 2019, 3:36:23 PM5/14/19
to MIT App Inventor Forum

can you show me (on the aia projet i sent you) how to Use the webstringview to transfer the full path of the file and use a web component to download the file ?
thank you

TimAI2

unread,
May 14, 2019, 3:44:10 PM5/14/19
to MIT App Inventor Forum
Here is a howto for using the webviewstring

tiko

unread,
May 15, 2019, 3:23:51 AM5/15/19
to MIT App Inventor Forum
thank you, but how to use the web component to download the file without open it ?

tiko

unread,
May 15, 2019, 3:33:03 AM5/15/19
to MIT App Inventor Forum
1- thank you, but how to use the web component to download the file without open it ?
2- how to test if the webviewer has load the page or not yet? (i want to show a progressdialog loading... until the full loading the php page in the webviewer ?)

TimAI2

unread,
May 15, 2019, 5:38:50 AM5/15/19
to MIT App Inventor Forum
It is getting to the point where you may wish to take a different approach:

  1. Use the web component to get a list of the pdf files on your server
  2. Use a listpicker or similar to provide the use the option to select a file
  3. Download the file to the device using another web component (you can use the same web component but it is more complicated)
  4. No need for a php page at all :)
How to download a file using the web component ?

tiko

unread,
May 15, 2019, 12:23:54 PM5/15/19
to MIT App Inventor Forum
1- i used the full url instead the relatif url, that works, the webviewer display some pdf files but not all documents!!!!
2- i must use phph page because the liste of pdf files is stored form database with a sql request (i want to search the list of documents by speciality, when the user select a speciality the phph page display links to document of the selectd speciaity).
3-for that i can't use a listpicker.

TimAI2

unread,
May 15, 2019, 1:23:30 PM5/15/19
to MIT App Inventor Forum
With reference to 2 above

A simple csv file that contains the filename (or whatever you want), the speciality and the file url on each row
can be imported to the app and converted to a list. you can display a list by speciality, select item and view/download pdf file

You can maintain the csv file in a google sheet, the app can update on startup or manually by user

You may be able to query the database directly from google sheets for the data ?

tiko

unread,
May 15, 2019, 2:22:57 PM5/15/19
to MIT App Inventor Forum
1-to be clear, the data base contains a lot of documents (of different speciality). the user will select speciality, display all document of selected speciality, then click on document to dowload it.

each document in the database is described by a short description (abstract of the document) + the file (pdf, rar ...), its for that i use the php page to display the result of the sql query in an html  table (each row contains a result: abstract+ link to download file.

the table document is like this: document_table(document_code, absract, link_to_download)

2- i have no idea on how to use google sheet !!!! is it efficient ?
3-sorry for my poor english (i speack french).

TimAI2

unread,
May 15, 2019, 7:09:57 PM5/15/19
to MIT App Inventor Forum
See attached simple example using listviews
also
Google Sheet which is downloaded as csv


(please note, this is sample data, so the urls are not real, and actual downloading is disabled in the aia_
Specialities.aia

tiko

unread,
May 16, 2019, 3:28:36 AM5/16/19
to MIT App Inventor Forum
- exelent example, thank you, i start understand.
- my database (the liste of documents) is updated by a php page. (the administrator has an html form to add a new documents), so how can i transform my database to csv file to use it in appinventor ??

TimAI2

unread,
May 16, 2019, 3:59:48 AM5/16/19
to MIT App Inventor Forum
If you can query the database from Ai2 ( using GET ?) , then you should be able to pull in a response that contains all the fields you need, then save this to a file in csv format (use this instead of the google sheet). You will need the file component.

I do not know what / where you database is...

tiko

unread,
May 16, 2019, 5:20:41 AM5/16/19
to MIT App Inventor Forum
- i use Mysql database, and the documents table is like this:
documents(code, abstract, url , speciality)
- i request database from php page because i think that it is simpler than using appinventor! what do you suggest?

TimAI2

unread,
May 16, 2019, 11:46:43 AM5/16/19
to MIT App Inventor Forum

tiko

unread,
May 16, 2019, 12:20:07 PM5/16/19
to MIT App Inventor Forum
yes but, in this exapmle :
1- there is no styling of the result (draw table for example to organize results)
2- dont' show how to download document.
i must do it! why it is so complicated to download a document in appinventor!!!

tiko

unread,
May 16, 2019, 12:47:18 PM5/16/19
to MIT App Inventor Forum

triste.jpg

i don't know what i must to do !!!

TimAI2

unread,
May 16, 2019, 1:13:19 PM5/16/19
to MIT App Inventor Forum
You are missing the point
You get the data table down from your database and then do everything in AI2 - no need to style/format to display in a webviewer (unless you really want to - but this just adds further complication)

Here also (if you prefer) a method to sync a google sheet with a mysql db

tiko

unread,
May 16, 2019, 1:34:19 PM5/16/19
to MIT App Inventor Forum
yes 'm lost!
to be clear, see here a screenshot of my application
- you can see the list of my documents organized in a table (by the php page)
- the problem occur whene i click download!
- do you speak french ?

Capture affichage.PNG

tiko

unread,
May 17, 2019, 7:17:07 AM5/17/19
to MIT App Inventor Forum
can you explain to me your previous response?

tiko

unread,
May 17, 2019, 7:38:23 AM5/17/19
to MIT App Inventor Forum
my application can display pdf files in the viewer but only for document with small size!!
- please, can you give me solution do download documents (all types of docuemtns) without open it in the viewer ?
thank you .

TimAI2

unread,
May 17, 2019, 8:13:09 AM5/17/19
to MIT App Inventor Forum
I provided a link to how to use the webviewstring further up in this thread

I have also provided alternative solutions for downloading files from an online server.

I do not know why your webviewer can only show smaller file size files, could be a limitation of the webviewer itself or a network/bandwidth/filesize issue on either the server side or your network ?

tiko

unread,
May 17, 2019, 3:26:28 PM5/17/19
to MIT App Inventor Forum
ok, i will test my application in an other server.
Reply all
Reply to author
Forward
0 new messages