[free lib]b4aPDFViewer by Icefairy333

corradotisi

Member
Licensed User
Longtime User
Broken link

Hi,
are there a link to download your b4aPDFViewer library ?

thanks
Corrado
 

francoisg

Active Member
Licensed User
Longtime User
getPageBitmap

Hi,
I am trying to get the "getPageBitmap" function to work but the only thing I get back is empty bitmap. Any ideas?

See my code below:

dim img AS ImageView
img.Initialize("")
img.Gravity = Gravity.FILL
Activity.AddView(img,0,0,100%x,450)

Dim bm As Bitmap
bm = pdfv.getPageBitmap(1, zoom, 0, 0, 0, 100, 100)
img.Bitmap = bm
 

susu

Well-Known Member
Licensed User
Longtime User
This is new link for PDFViewer Lib by Icefairy333
 

francoisg

Active Member
Licensed User
Longtime User
Get current page number being viewed ...

sorry another ask,is possible to get the current page number?
thank you

Try the following code (makes use of the Reflection library)

Public Sub getCurrentPage(PDF As PDFViewer) As Int
Dim r As Reflector
r.Target = PDF
Return r.RunMethod("getCurrentPage")
End Sub
 

aligalehban

New Member
Licensed User
Longtime User
PDF Viwer

whiel i was working with PDF viewer Lib i found out that only PDf can be load from SD card or phone memory

pdfv.init
Activity.AddView(pdfv,0,0,-1,-1)
pdfv.getpdf("/sdcard/content.pdf")
pdfv.zoom(1.0)

:sign0089:
 

Espinosa4

Active Member
Licensed User
Longtime User
Please, guys,
I am trying to use the scrollToPage function but nothing happends.


Activity.AddView(pdfv,0,0,-1,-1)
pdfv.getpdf(File.DirInternal&"/lr.pdf")
If pdfv.isValid Then
'Log("pagecount:"&pdfv.PageCount)
pdfv.scrollToPage(5)
pc=pdfv.GetPageCount
pdfv.zoom(3.0)
Else
Msgbox("Error pdf file!","Error")
Activity.Finish
Return
End If

Can you help me please?

Thank you very much
Espinosa
 

francoisg

Active Member
Licensed User
Longtime User
Hi,
it works perfectly when I try it. Are you sure there are actually 5 pages? As far as I know the first page should be page 0?
 

Espinosa4

Active Member
Licensed User
Longtime User
My pdf file has 94 pages. My question is... Can I go to the page for example 25 directly?

Cheers

Enviado desde mi GT-I9001 usando Tapatalk 2
 
Last edited:

francoisg

Active Member
Licensed User
Longtime User
Yes, you should be able to go directly to a page without any issues. It works in my case ...
Not sure what the issue is on your side. Have you tried with different PDF files?
 

Espinosa4

Active Member
Licensed User
Longtime User
Hi francoisg
Thanks for your reply.
Yes, I am trying with other ones but is the same. I am sure, I've and error but I don't know where.

Cheers
 

korshkov

Member
Licensed User
Longtime User
Hi to All.
I add some function for this lib:
B4X:
Public Sub setRotation(PDF As PDFViewer, angle As Int) 'worked

 Dim r As Reflector
 r.Target = PDF
 Return r.RunMethod2("setRotation", angle, "java.lang.int")

End Sub

Public Sub getRotation(PDF As PDFViewer) As Int 'worked

 Dim r As Reflector
 r.Target = PDF
 Return r.RunMethod("getRotation")

Public Sub ZoomWidth(PDF As PDFViewer) 

 Dim r As Reflector
 r.Target = PDF
 r.RunMethod("zoomWidth")
End Sub

Public Sub ZoomFit(PDF As PDFViewer)

 Dim r As Reflector
 r.Target = PDF
 r.RunMethod("zoomFit")

End Sub


End Sub

For fix zoomout i use:
B4X:
PDFCurrentPage = getCurrentPage(pdfv)
ZoomValue = ZoomValue-0.25
pnlContent.RemoveAllViews
pdfv.init
pnlContent.AddView(pdfv,0,0,-1,-1)
pdfv.getpdf(CurrentFolder&"/"&Filename)
   
If pdfv.isValid Then
 pdfv.ScrollToPage(PDFCurrentPage)
 pdfv.Zoom(ZoomValue)
end if
On my ASUS eePad TF201 (Android 4.1.1) ScrollToPage not working.

See on PagesView.java - apv - APV PDF Viewer - Google Project Hosting this function and not undertand "Why?".

P.S. Excuse me for my bad English
 
Last edited:

korshkov

Member
Licensed User
Longtime User
For ZoomIn and ZoomOut create this sub
B4X:
Public Sub PDFZoom(PDF As PDFViewer, zoomlevel As Float)

 Dim r As Reflector
 r.Target = PDF
 Return r.RunMethod2("zoom", zoomlevel, "java.lang.float")

End Sub

and

use:
- for zoomIn - PDFZoom(pdfv, 1.414)
- for zoomOut - PDFZoom(pdfv, (1/1.414))
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…