[free lib]b4aPDFViewer by Icefairy333

shaxboz

Member
Licensed User
Longtime User
Hi! How can I go to specific page, for example page 10 of my pdf file?
I am using scrollToPage(10) but, nothing happened. I checked with 5 pdf file.

And second problem:
When I open second file, my app is restarting. And after this restart it will open this pdf file, but When I open next pdf file this library second time restarting...
Always I have to click every file two times for open by this library, Because always it will restarting my app.

This library is good, It showing pdf files. Thanks for it, but functions of library is not working correctly.
 
Last edited:

shaxboz

Member
Licensed User
Longtime User
There was a previous post:

Hi,

When I use this library on a second Activity and close the activity after viewing PDF and start it again I get " Fatal signal 11 (SIGSEGV) at 0x00000014 (code=1) "

Any suggestions?

I am having the same problem in that the first time I start the activity all works well, the next time my application restarts. Is there a way of releasing or clearing the memory associated with the PDFViewer object.

Again any suggestions would be appreciated.

Thanks

I have like that problem with this library. When I open pdf file second time, my app is restarting. Anybody solve this problem?
Maybe I should use with reflector?
How can I use this "getpdf" method with reflector library?
I have this code:
B4X:
    Dim r As Reflector
    r.Target = pdfv
    r.RunMethod2("getpdf",File.DirRootExternal&"/1.pdf","java.lang.string")
But it is not working...
 

MarcoRome

Expert
Licensed User
Longtime User
Hi all. I have this problem, all work but when i exit and recall the module.... crash.
Example: I enter and click in Listview file's 1, 2 , 3, n...and work without problem. When i exit application and recall and select one file in ListView...crash. After crash i retry and work...without problem.
I dont see Release property .....
In attachment source. Request Library IcefairyPdf ( of course :) ) and MFLib 1.07
Any idea ???

This is code:
B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Dim MF_File As MF_File
End Sub
 
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim ListView1 As ListView
    Dim pdfv As PDFViewer
    Dim i,pc As Int=0
    Dim iv
    Private Button1 As Button
    Dim fileselezionato As String
End Sub
 
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("pdf")
   
    Activity.Title = "XXX Plus"   
    'Imposto ListView a tutta altezza
    ListView1.Height = 100%y
   
   
    Dim testPath As String = File.DirRootExternal&"/xxxplus/"
   
    Dim Bitmap1 As Bitmap
    Bitmap1.Initialize(File.DirAssets, "pdf-icon.png")
    If pdfv.IsInitialized = False Then
    pdfv.init
    End If
   
    Activity.AddView(pdfv,0,50%y,-1,-1)
    pdfv.Visible = False
 
   
    Log("MF_File.ListFiles")
    Dim files As List
    files = MF_File.ListFiles(testPath, "*.pdf", True, False)
    If files.IsInitialized Then   
        For Each f As String In files
            Log("    " & f)
            ListView1.AddTwoLinesAndBitmap(f, "File Pdf", Bitmap1)    
        Next
    End If
 
End Sub
 
Sub ListView1_ItemClick (Position As Int, Value As Object)   
    ProgressDialogShow2("Anteprima File selezionato...",False)
    DoEvents
    ListView1.Height = 40%y
    fileselezionato = Value
    Button1.Visible = True
    Button1.Text = "Click Here to " & Value & " to XXX"   
'Leggo File Pdf in anteprima
   pdfv.Visible = True
   pdfv.getpdf(File.DirRootExternal&"/Ocrplus/"& Value)
   If pdfv.isValid Then
      'Log("pagecount:"&pdfv.PageCount)
      pdfv.scrollToPage(0)
      pc=pdfv.GetPageCount
      pdfv.zoom(1.0)
      ProgressDialogHide
   Else
         ProgressDialogHide
      Msgbox("Error pdf file!","Error")
      'Activity.Finish
      'Return
   End If
End Sub
 
Sub Activity_Resume
 
End Sub
 
Sub Activity_KeyPress(KeyCode As Int) As Boolean
 
    If KeyCode = KeyCodes.KEYCODE_BACK AND ListView1.Height = 40%y Then
        Button1.Visible = False
        pdfv.Visible = False
        ListView1.Height = 100%y
        Return True
    Else If KeyCode = KeyCodes.KEYCODE_BACK AND ListView1.Height = 100%y Then
        Activity.Finish
    End If
 
End Sub
 
 
Sub Activity_Pause (UserClosed As Boolean)
    ' Rivedere per far tornare indietro su immagini
 
   
End Sub

Thank You.
 

Attachments

  • Test.zip
    163.6 KB · Views: 401

Bernhard Svavarsson

Member
Licensed User
Longtime User
Tested the PDFview example (from Icefairy333 I think).
Compiles fine and when running the app a message pops up:
"Loading pdf file.." then nothing happens - screen blank and seems to be frozen.

Anyone seen this behaviour?

Regards

Benni
 

Bernhard Svavarsson

Member
Licensed User
Longtime User
Ok it seems to be some error in java reference:

This is the log whic I get when running the app:

** Activity (main) Create, isFirst = true **


Error occurred on line: 39 (main)
java.lang.RuntimeException: failed to load pdf file: getPageCount returned -1


at cx.hell.android.pdfview.PDFPagesProvider.getPageCount(PDFPagesProvider.java:498)
at cx.hell.android.pdfview.PDFPagesProvider.getPageSizes(PDFPagesProvider.java:508)
at cx.hell.android.lib.pagesview.PagesView.setPagesProvider(PagesView.java:342)
at ice.pdfviewer.pdfviewerwrapper.setpagesProvider(pdfviewerwrapper.java:129)
at ice.pdfviewer.pdfviewerwrapper.getpdf(pdfviewerwrapper.java:120)
at b4a.example.main._activity_create(main.java:337)
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:636)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:305)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:238)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:121)


at b4a.example.main.afterFirstLayout(main.java:98)
at b4a.example.main.access$100(main.java:16)
at b4a.example.main$WaitForLayout.run(main.java:76)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
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:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
** Activity (main) Resume **

regards

Benni
 

JoanRPM

Active Member
Licensed User
Longtime User
You need to put in the device, in DirRootExternal, the PDF you wants to read, for example: manual.pdf
Also you need to change this code line:
pdfv.getpdf(File.DirRootExternal&"/manual.pdf")

This error ocurs when the system can't find the file.

Regards.
 

vecino

Well-Known Member
Licensed User
Longtime User
Hi, definitely, this library is not stable.
I have spent much time and effort to integrate it into my software, but the problems are continuing.
Regards.
 

vecino

Well-Known Member
Licensed User
Longtime User
No, it's not that.
Freezes the system.
It closes for no reason.
etc.
 

gmilias

Member
Licensed User
Longtime User
It would be very kind, if someone who has already downloaded the lib, could send it to me, as every link that I found in this thread is broken:( (gmilias@yahoo.com). Thanks in advance.
 
Top