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
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?
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.
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))