Android Question PDF Scroll via code

Adie

Member
Licensed User
Longtime User
Hi all
OK, I am new to android and all its nuances, so bare with me.

Problem
I must display a PDF on screen and smooth scroll it via code. It will actually be ONE page that could be up to 9 meters long and A5 wide. (It is a Rally Roadbook up to 2Mb in size) There will be no access to the touch screen!!!.

I searched the net and found 2 libraries (from this site) that could work EXCEPT that the PDF object is in fact already a 'scrollable object' so it can not be displayed via the ScrollView object and scrolled 'again'. Maybe it can but I can not set the scrollable panel Height to the required pixels (9 meters) could not evaluate Don

Both these libs scroll the PDF 100% if on a panel via swiping the screen. I could not find any exposed .Scroll** methods other than 'toPage', top or Bottom.

Possible solution
Override the 'Scroll' event from code. (simulate the swipe) now, I don even know where to start.

Any help will be appreciated.

Adie
 

keirS

Well-Known Member
Licensed User
Longtime User
There are at least two libraries on here that render a PDF to a bitmap. Both require Lollipop or later. Here is a link to the one I wrote and here is the one written by @DonManfred

Once you have generated a bitmap you can use the ScrollView2D view. Set the inner panel size to the size of the bitmap and then call SetBackgroundImgae() to set the bitmap as the background. Use the SmoothScrollTo() method of the ScrollView2d to scroll.







 
Upvote 0

Adie

Member
Licensed User
Longtime User
In the meantime

1. I also sent a message to the developer of one of the Lib's. (Icefairy). He does not have the code anymore.
2. I have nit tried the DonManfred Lib as the tablet I'm using is still V4.....

Still looking
Adie
 
Upvote 0

keirS

Well-Known Member
Licensed User
Longtime User
You can do exactly as i describe using the library provided by @icefairy333 . Use the getPageBitmap method to get 100% rendering of the page as a bitmap and then use a ScrollView2D to view and scroll it/
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…