[FREE] Create PDF file Extension. Layout to PDF

@Serkan_Duyan

In this web page you can find the extensions com.KIO4_PdfS10.aix and com.KIO4_Pdf10.aix.

Files are saved in ...

/storage/emulated/0/Android/data/edu.mit.appinventor.aicompanion3/files/ ... in emulation with Companion.

And...
/storage/emulated/0/Android/data/'namepackage'/files/. .. when Built.

Can you test if they work for you?
http://kio4.com/appinventor/284C_extension_crear_pdf.htm

@Juan_Antonio,

Muchas Gracias.... You are the best...

2 Likes

Thanks @Serkan_Duyan

On this website there is an extension called com.KIO4_Pdf10.aix, through this extension we can create pdf files in Android versions >= 10.

The created file will be saved in:
/storage/emulated/0/Android/data/edu.mit.appinventor.aicompanion3/files/ if you are in the MIT Companion emulator

and in
/storage/emulated/0/Android/data/'namepackage'/files/ if the application is installed (Build .apk)
You can get the path of that directory using the GetAndroidAppDirectory block.

Here a basic example.

borrar_createPdf_A10.aia (11.9 KB)

so if someone likes to create an app, which should work for all Android versions, both extensions have to be used? Can't you join the functionality and provide only one extension which works for all versions?

Taifun

2 Likes

Hello Taifun,

Actually it can be used for both, if they are set in ASD. Seems we need to pass all our APP's to ASD soon and I started to do that.

I have taken the easy way, I have joined the two extensions.
Now the extension is called com.KIO4_Pdf.aix, if you use the blocks that end in 10 (Create10, AddPage10 and Finish10) the files will be created in ASD, these blocks are appropriate to Android> = 10.
If you use the blocks that do not end in 10 (Create, AddPage and Finish) you will be able to choose other directories of the SdCard, these blocks are appropriate for Android <10.
Using the GetApi block, you can get the Android version of the device.

Example:

You can download the extension from:
http://kio4.com/appinventor/284C_extension_crear_pdf.htm

4 Likes

Thank you @Juan_Antonio

3 Likes

2 posts were merged into an existing topic: Creating and Sending PDFs via whatsapp or email

hi
it seems that the extension no longer saves in internal memory.
after updating my cell, it doesn't work.
first created the .pdf file
my GetApi returns 30.
I use the pdf10 function even when using the aia file downloaded on the kio4.com website it does not work.
someone has tried yet.
thank you

@Giovanni_Maria_Lombi

To work on Android 10+, you must use the Create10, AddPage10 and Finish10 blocks, the file the_pdf.pdf will be created in
/storage/emulated/0/Android/data/'namepackage'/files/

1 Like

Thank you for your answer.
already use Create10, AddPage10 and Finish10 blocks.
but the file is not found.
also using the aia file referenced on the site, the comida.pdf file is not found.
I had no problems before.
in my opinion something has changed on version 11 api30
try to see this link
Problem with July 30 2020 Version: nb184 no longer able to write and read files - #50 by ewpatton anke
but I'm not an expert and maybe I'm wrong

Just built a project from scratch, and tested, using Companion app, on

Android 10 (genymotion emulator)
Android 11 (google pixel 4a)

PDF created OK with both.

Order of things:

  1. Show context
  2. Create the pdf
  3. Add a page
  4. Finish
  5. Read pdf to image component

Try my aia project. I have added a click event to the image, if you touch the image after reading the pdf you get the message, scroll the page to see the original vertical arrangement.

pdfA11.aia (12.0 KB)

1 Like

i have try you new aia file, but, sorry no work for me.
strange because it worked well before.
if it can be useful to you. I have a samsung.
try to test on a samsung terminal.
thank you

Thanks @TIMAI2 for testing the extension.

I have tested Tim's code and it works for me on Android 9, MIT Companion and installed.

pdfA11_B.aia (12.0 KB)

ok the app reads the file created, but if I look for it, the file.pdf physically in my internal memory can't find it.
while before I saw the file.pdf.
is there any way to save it in Download?

thank you.

Why save to downloads? Explain what you want to do.

because in android 11 the android / data folder is no longer visible. (it is empty) before I could open the pdf file and print its content.
now the created.pdf file is no longer visible for android restrictions.

if you can save in Download or Document you can again (in android 11) open the file and print.
it is important for my app.

thanks for your help.

1 Like

Currently (April 2021), it is possible, using a file extension, to copy/move files to common folders on the sdcard.

This may change when AppInventor starts to target API 30 (full on Android 11 with all restrictions applied), and our current understanding is that you cannot then copy files in the same way.

We won't really know what the possibilities will be until Google/MIT sort all this out.

2 Likes

well, for now i will use copy to fix in android 11.
thanks.

Hello
How can I add more than one layout (exable 2 Horizontal Arrangements) to the Block ad page layout .

I need add in layout in the above block for exable Horizontal Arrangements1 + Horizontal Arrangements

1 Like