PdfViewer Lib Problem

Theera

Well-Known Member
Licensed User
Longtime User
Hi all,
I've tried to learn the Icefairy333 's pdfviewer demo. I've error message and wonder about Addview() command. Please help me to clearly?

B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim pdfv As PDFViewer
    'Dim i,pc As Int=0
    Dim pc As Int=0
    'Dim iv
   
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("Layout1")
   
   '*****************************************************
   '*DBUtils is Code Module,We cann't use it as library *
   '*****************************************************
   
    pdfv.init
    Activity.AddView(pdfv,0,0,-1,-1)
   'Activity.AddView(pdfv,0,0,100%x,100%y)
   'pdfv.getpdf(DBUtils.CopyDBFromAssets("UsersGuide.pdf")&"/UsersGuide.pdf")
   'Cut only sub module:CopyDBFromAssets
   pdfv.getpdf(CopyDBFromAssets("UsersGuide.pdf")&"/UsersGuide.pdf")
    If pdfv.isValid Then
        'Log("pagecount:"&pdfv.PageCount)
        pdfv.scrollToPage(0)
        pc=pdfv.GetPageCount
        pdfv.zoom(3.0)
        
    Else
        Msgbox("Error pdf file!","Error")
        Activity.Finish
        Return
    End If
End Sub
Sub CopyDBFromAssets (FileName As String) As String
   Dim TargetDir As String
   If File.ExternalWritable Then TargetDir = File.DirDefaultExternal Else TargetDir = File.DirInternal
   If File.Exists(TargetDir, FileName) = False Then
      File.Copy(File.DirAssets, FileName, TargetDir, FileName)
   End If
   Return TargetDir
End Sub
P.S. zip file size 3.26 MB couldn't upload
 

Attachments

  • Strange.png
    Strange.png
    29.9 KB · Views: 419
  • error.png
    error.png
    11.1 KB · Views: 457
Last edited:

Theera

Well-Known Member
Licensed User
Longtime User
Hi all,
I 've done already,I add the wrapper lib(pdfviewer.jar ,besides b4apdfviewer.jar and b4apdfviewer.xml). But I see only white panel.
 
Last edited:
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
Hi all,
I see only white panel.

I found this problem, Klaus's the first page of guide is almost of white. Not be bug.:sign0013:
 
Upvote 0
Top