I want to save the page number of a pdf in a database

I inserted the pdf files into the application using the aia file from the topic at the following link

The file works fine
And now I want to make the application automatically save the number of the page of every pdf that I read and record it in the database, and thus once I reopen the application, it sends me directly to where I stopped reading last time
Can someone help me please?

This is what the existing blocks look like

blocks (2)

blocks (9)

How do you know which page you viewed last time with this extension?

unfortunately with this extension i dont know that, so i need help to be able to know and save the page where i was the last time i used the app and can continue reading when i open it again

How to do what you want is shown in the documentation for the extension. Once the pdf is loaded, you can scroll to you desired page. Save this page number in a tinydb for sending via the webviewstring.

User must tap the page to select the page number.

These blocks are using a pdf file in assets in the companion

1 Like

i appreciate your help, many thanx.
when i tried join block it was with tow places only not three
that is why i couldnt continue the steps you sent
if you could send me the aia file i will be grateful for you

Also you have spelt assets incorrectly

thank you, i made the blocks but the app gave me a runtime error "no such file or directory"

and this is using the companion app with your file pdfFile.pdf in the media folder ?

Also, what Android version are you testing on, the assets path will be different for Android <= 9 when using companion?

@TIMAI2 I exported the app as an .apk file and tried to run it on my phone... is this what you mean by "companion app" or there is other things i have to do?

yes, I have an pdfFile.pdf in the media folder

Android version was 7 but the problem still present even in another device with android version 12

maybe you want to try this extension:

1 Like

@Kevinkun many thanx, it's very good extension. how can I make the button get me to the last page I was reading before close the app not to a page I wrote its number?

when scrolled, save the page number to tinydb.

when button clicked, get the page number from tinydb, then use Goto function.

@Kevinkun thanx, I'm not expert so I tried to do what you said but I had a runtime error
the blocks and the error in attachment
so what is my fault?

Pdfviewer.goto (tinydb.getvalue ( 'pageinview'))

1 Like

@Kevinkun thank you very much, it's working now... I appreciate your help

@Kevinkun I'm trying to make the pageInView be saved when clicking a button not when scrolling the pdf but I get this error
Can you kindly help me getting this done?


this is just some basic : you can not run the code when there is error on the code, did you see the red error mark?
initialize a global variable. in Scoll event set the variable to pageinview, then use the variable at the error mark.