Beta PDFium - Pdfview2

Marco Nissen

Active Member
Licensed User
Longtime User
Regarding the new PDF library wrapper by @DonManfred

Hi, I still get the ontap issue - if I tap the pdf, I get the error below with the sample code (no change)

B4X:
java.lang.Exception: Sub pdfium_ontap was not found.
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:202)
    at anywheresoftware.b4a.BA$2.run(BA.java:370)
    at android.os.Handler.handleCallback(Handler.java:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:201)
    at android.app.ActivityThread.main(ActivityThread.java:6806)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)

Any idea? This looks like a bug to me.

Also, do you possibly know how get to know when the user performed a zoom action?
Like a rendering event ? There is one function called "addOnRenderListener", which could probably do that, but none of the provided events are called
Also not for the addOnDrawListener ..

From the PDFAndroidViewer original code I think the ondrawlistener should be added to the wrapper to implement the behavior


Thank you
Marco
 

DonManfred

Expert
Licensed User
Longtime User
Try v1.01 (download on Dropbox)

B4X:
Sub Pdfium_onTap(event As Object)
    Log($"Pdfium_onTap(${event})"$)
End Sub
Sub Pdfium_onPageScrolled(arg0 As Int, arg1 As Float)
    Log($"Pdfium_onPageScrolled(${arg0},${arg1})"$)
End Sub
Sub Pdfium_onLayerDrawn(cnvs As Object, arg1 As Float, arg2 As Float, arg3 As Int)
    Dim jocnvs As JavaObject = cnvs ' Honestly i don´t know what we can do with it :D
    ' The Canvas is a android.view.DisplayListCanvas

    Log($"Pdfium_onLayerDrawn(${arg1},${arg2},${arg3} (Zoom = ${PDFView1.Zoom}))"$)
End Sub
Also, do you possibly know how get to know when the user performed a zoom action?
Zoom is a Property of the pdfView. See the Pdfium_onLayerDrawn event above. I´m using the Zoom here. You can get the Zoom in a timer if you want. Or at any time.
 
Upvote 0
Top