See the App Inventor Extensions document about how to use an App Inventor Extension.
For questions about this extension, bug reports and feature requests, please start a new thread in the App Inventor Extensions forum. Thank you.
Nov 14th, 2016: Initial Version 1
Nov 19th, 2016: Version 1a: bug fixes
Extension to open pdf files and render a specific page (without using an external app).
Required permissions: android.permission.READ_EXTERNAL_STORAGE, android.permission.WRITE_EXTERNAL_STORAGE
Minimum API level of this extension is 21 (Android 5)! Please adjust this in the manifest of your app!
Returns whether Warnings should be suppressed
Specifies whether Warnings should be suppressed
Returns the number of pages
Open a pdf file.
Prefix the pdfFilename with / (i.e. relative path) to open a pdf file from the SD card. For instance /myFile.pdf will open the file /mnt/sdcard/myFile.pdf. To open a pdf file from the assets packaged with an application (also works for the Companion) start the pdfFileName with // (two slashes). If a pdfFileName starts with file:/// you can specify a complete path to the pdf file.
Note 1: spaces in the pdf file name are not allowed!
Note 2: to open a pdf file from the assets is currently an experimental feature, see the Known Issues.
Render a specific page.
Event indicating that pdf file was opened.
If the pdf file was opened successfully, the flag 'successful' is true and the pdfFileName is provided in the response. In case of an error, flag 'successful' is false and the error message is provided in the response.
The example offers the possibility to pick a pdf file from the assets, renders a specific page
and displays it in the webviewer to be able to zoom in/zoom out. You also can enter the path to the pdf file manually.
Tested successfully on Nexus5 running Android 6.0.1 and Nexus 5X running Android 7.
It has been reported, that opening a pdf file from the assets on a Lollipop device (Android 5) results in a runtime error.
Unfortunately I do not have an Android 5 device, so I'm unable to test on such device.
In case you have an Android 5 device and you like to help me to fix this issue, then please contact me by email. Thank you.
As workaround just use the Copy block from the File extension to copy the file first to the sdcard and view it from there.
I can help you: for one hour I charge 25 USD.
Please contact me at info [at] puravidaapps [dot] com for details!
For questions about App Inventor, please use the App Inventor forum. Thank you.
Download Pdf test app (apk file). Minimum API level of this extension is 21 (Android 5)!Note: The Test app (apk file) uses a special version of the extension, which means, in one day in the future the extension will display an error message and will stop working. This was necessary to prevent dishonest people from extracting the extension from the apk file. Extracting a paid extension from an apk file violates the intellectual property rights of Pura Vida Apps. Don't do that! Thank you.
You can buy this extension (aix file).
With your payment you accept the terms and conditions below.
Please transfer 10 USD via Paypal.
After having received your payment I will be happy to send the extension (aix file) to you.
Thank you! Taifun
Please check your spam folder in case you did not receive the extension!
I usually will send the extension not later than 24 hours after having received your payment.