I want to open a pdf file in app inventor

I want to open a pdf file in app inventor.Please show how can i do this .Do not show me not free extension such as pura!

:rofl:

How to view a pdf document

Taifun

1 Like

Thanks but I am completely confused.I have for example 3 pdf files.I want to open them in my application . I want to build apk.My pdfs were not in my apk when I build apk file.How can I write code for such app.I don't know start point for coding this app.Can you write a code that opens some pdf files which installed with the app .Not from web or from Companion.Please!

Upload your pdfs to the Media/assets area in the Designer/Blocks editor

image

These files will then be included in your apk as assets.


in this picture what must be changed.I write this code in AI and connect to companion and rename the DATAURL to my pdf file name( for example media.pdf) and when click view from device it was shown but when build apk no file was shown by app.H uploaded my file and its default scope was App.

I know this contradicts a particular statement in your original topic, but you can use Taifun's PDF extension; it should save you a lot of time.

Edit: Sorry, I didn't realize it was paid.

Can't anyone help me? With this huge volume Technology?!!! ...

Where is the pdf you want to view?

  • online
  • in your assets
  • in your ASD
  • in your sdcard somewhere

if you want to use the activity starter solution, then you must copy your pdf files from the assets to shared storage and open it from there

Taifun

I want to store pdfs with my apk.User read them in the app after installing. I am not very expert in building app and I don't have enough information about file storage ,copy , read ,address of files or difference between Asset , Asd and ... . I didn't find a good reference about working with files specially . I don't expect you very much and I am not rude but I apply to you for help .If you can write a code and send me apk and aia for underestanding what I must do,else show me a good reference for working with files.I read several times code of pdf extensions and wrote them and built apk but there was no result.If Activity Starter is better help me about this possibility.

What do you want ? it's not clear and you never answer questions.

Try this simple aia project, using my ViewPDF extension. This will not work in companion, you will need to compile it.

SCREEN
image

BLOCKS

AIA
View3PDFs.aia (2.1 MB)

APK (link)
View3PDFs

1 Like

This version works also with Companion:
View3PDFs_2.aia (2.1 MB)

Summary

Why we can not view them from asset ?

Because I didn't include that option in the extension.

Can I use your ext with shared folders ?

I do not see why not, the extension should take an absolute or full path to the folder/file. You may need the read permission?
(for assets there is a need to call the assetsPath inside the extension)

Full path (doesn't work):

Summary

Absolute path (works):

Summary

This works without WRITE / READ permissions on Android 11+:

2 Likes

Note: When you test with Companion first, you must delete the PDFs while running Companion on Android 11+. Otherwise you'll not able to test with the APK, because the PDF files are then created by another app (Companion) and connot be overwritten with the new app (APK).

Also you must request WRITE permission on devices with Android < 11.

Summary