[free lib]b4aPDFViewer by Icefairy333

imgsimonebiliato

Well-Known Member
Licensed User
Longtime User
Hello,
how can I set zoom, by pinch zoom in/out?
 

imgsimonebiliato

Well-Known Member
Licensed User
Longtime User
Using:
B4X:
Dim bmp As Bitmap
bmp = pdfv.getPageBitmap(1, 1.0, 0, 0, 0, 100, 100)

the bmp isn't initialized.. So I think that, this method doesn't return a bitmap...
It is correct?
 

DonManfred

Expert
Licensed User
Longtime User

Baris Karadeniz

Active Member
Licensed User
I downloaded from the Post #1 but there are logs. So I thought it is changed. If it is the last, than I need to correct log: "unused variable pc" But it is used. So why there is a log???
 

Baris Karadeniz

Active Member
Licensed User
When I try to open a file which is downloaded with webview, I receive an error below,

Installing file.
PackageAdded: package:app.taksim
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Service (downloadservice) Create **
** Service (downloadservice) Start **
** Service (httputils2service) Create **
** Service (httputils2service) Start **
Job completed: true
java.lang.UnsatisfiedLinkError: dlopen failed: library "/data/data/app.taksim/files/libpdfview2.so" not found
at java.lang.Runtime.load(Runtime.java:333)
at java.lang.System.load(System.java:512)
at ice.pdfviewer.pdfviewerwrapper.init(pdfviewerwrapper.java:109)
at app.taksim.main._dd_complete(main.java:469)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:702)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at anywheresoftware.b4a.BA$2.run(BA.java:328)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5602)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)


The codes are;

B4X:
Sub dd_Complete(Job As HttpJob)
    Log("Job completed: " & Job.Success)
    Dim o As OutputStream
    o = File.OpenOutput(File.DirDefaultExternal, "l.bal", False)
    File.Copy2(Job.GetInputStream, o)
    o.Close
    If Job.Success = True Then
    Activity.LoadLayout("Layout2")
    Dim pdfView As PDFViewer
    pdfView.init
    Activity.AddView(pdfView,0,0,-1,-1)
    pdfView.getpdf(File.DirRootExternal&"/l.bal")
    End If
    Job.Release
End Sub

What sould I do?
 

hibrid0

Active Member
Licensed User
Longtime User
When I try to open a file which is downloaded with webview, I receive an error below,

Installing file.
PackageAdded: package:app.taksim
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Service (downloadservice) Create **
** Service (downloadservice) Start **
** Service (httputils2service) Create **
** Service (httputils2service) Start **
Job completed: true
java.lang.UnsatisfiedLinkError: dlopen failed: library "/data/data/app.taksim/files/libpdfview2.so" not found
at java.lang.Runtime.load(Runtime.java:333)
at java.lang.System.load(System.java:512)
at ice.pdfviewer.pdfviewerwrapper.init(pdfviewerwrapper.java:109)
at app.taksim.main._dd_complete(main.java:469)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:702)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at anywheresoftware.b4a.BA$2.run(BA.java:328)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5602)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)


The codes are;

B4X:
Sub dd_Complete(Job As HttpJob)
    Log("Job completed: " & Job.Success)
    Dim o As OutputStream
    o = File.OpenOutput(File.DirDefaultExternal, "l.bal", False)
    File.Copy2(Job.GetInputStream, o)
    o.Close
    If Job.Success = True Then
    Activity.LoadLayout("Layout2")
    Dim pdfView As PDFViewer
    pdfView.init
    Activity.AddView(pdfView,0,0,-1,-1)
    pdfView.getpdf(File.DirRootExternal&"/l.bal")
    End If
    Job.Release
End Sub

What sould I do?


Hi bro, I check your code and now I see is working, please test by yourselft.
 

Attachments

  • 1.zip
    23.5 KB · Views: 421

Baris Karadeniz

Active Member
Licensed User
I think I have problem with my phone. I still get same error at your example also. I will check with another phone and let you know. Thanks.
 

DonManfred

Expert
Licensed User
Longtime User
I played a bit with this lib today

The original implementation of this lib expect a file named zf in the files-folder.
when calling init this file is extracted (it is a zip file containing the .so file) to internal cache folder.
Then the native .so is loaded with system.load() from the cachefolder

I did recompile the jars, restructured it a bit and compiled it again (now including the .so file directly in the jar which now have a size of 3.7mb)...

It is working showing a onepage pdf with a high height of the page (around 9 meters) pdf in my example now...

Nice lib, @icefairy333 !
 

adastra

Member
Licensed User
Longtime User
hi
i am using this library , it is working fine once but when i open activity again it got crashed. do't know why, can any budy help
 
Top