How do you save a file as pdf to be matching with all android versions easily?

I have a problem with the new versions of android like android 10 and specially android 11 (when i try to save a file like ''vertical arrangement'' as pdf file i can't find any pdf on mobile storage). But when i use any old android version i can save '' vertical arrangement'' as pdf file and i can find it easily on mobile storage even if i use WRITE_EXTERNAL_STORAGE or READEXTERNALSTORAGE .I'm using (Kio4 pdf extension).

.
My question is : there is no way to save as pdf file to be matching with all android versions (old versions and new versions)? what are the permissions required to be able to save a pdf on mobile storage on any android version?

1 Like


i try using your instruction but unfortunately with no success. there is no create-pdf in (Kio-4 ) new version. i don't know how to create pdf and how to save it.


is it right like that to save (vertical arrangement) as pdf file?? and is it important to create a directory to save because i didn't found any files after saving.

The documentation shows you how to do it:

http://kio4.com/appinventor/284C_extension_crear_pdf.htm

I still need more explication .. what are the missing bloks

Well it is all there...

You do not seem to be using a finish block, as per the documentation.

You are using the 10 blocks, therefore your pdf will be saved to the application specific directory:

/storage/emulated/0/Android/data/<packageName>/files/yourpdf.pdf


I using finish block and it's already save the file ... the problem is with Android 11 " the file does not appear "
what are missing blocks??????????

Where are you expecting the file to appear with just those blocks ?

What blocks are you using to display the pdf or show its file path ?

Where are you expecting the file to appear with just those blocks ?
the answer is : Yes
just by using those blocks .... the file is saved with old android version like 5 , 8 , 9

What blocks are you using to display the pdf or show its file path ?
the answer is yes
this is what I'm looking for.... the missing blocks are like what??
To show the pdf file so the blocks are what? can you give me some suggestions to how show the pdf file or the file path .... if you please.


is that what you mean by how files can appear?


i'm still waiting your suggestions :cry:


They are my blocks used to save the vertical arrangement components ... the file is saved with all android version except the version 11.
So how can save this file with any android version ???????????
I can't believe that after all this time there is no solution to saving files with android 11
where are MIT app inventor helpers ?????????????? Where are the genius app inventors in all the world wide????????
after these blocks ...what are the required blocks ???? to save with android 11 or any android version ???????

I have just tested these blocks:

The pdf file is saved (as I previously advised you) to:

/storage/emulated/0/Android/data/<packageName>/files/mynewPDF.pdf

when using the companion app, <packageName> is:

edu.mit.appinventor.aicompanion3

With Android 11 you can only access the saved pdf file from this location and from within your app, unless you move it / copy it. You can do this with the Taifun File extension. You need to set the DefaultFileScope to Shared in Screen1 properties in the designer, and you will need the file component to get the ASD (for these blocks). Once compiled, this method successfully copied the pdf I created to the Documents folder, and this was then accessible and viewable using other apps on my device.

image

If you need access by other means then perhaps export the file to an online resource like Google Drive

There is also this extension:

which will allow you to view an entire pdf using the webviewer.

No extension is required for this:

Btw, here is another bug with the File comp.

grafik

I want a link for this extension " File 1 "
If you please

Its a component.

grafik

Many thanks Anke :heart_eyes:; I will try and I will give you a feedback about the result

Precisely :slight_smile:

you might want to start a new thread to report that bug and add a small example project how to elicit the error, so @ewpatton and the team can fix it...

Taifun