Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim pdfr As PdfRenderer
Dim pdfPages As Int
Dim activepage As Int
Private btnPrev As Button
Private btnNext As Button
Private lblPage As Label
Private img As ImageView
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("main")
File.Copy(File.DirAssets,"modbau14.pdf",File.DirRootExternal,"modbau14.pdf")
End Sub
Sub Activity_Resume
pdfr.Initialize("pdf",File.DirRootExternal,"modbau14.pdf", File.DirRootExternal&"/PDFs")
pdfPages = pdfr.PageCount
activepage = 0
pdfr.renderPage(activepage)
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub pdf_pagerendered (page As Int, pagecount As Int, image As Object)
activepage = page
If activepage = pagecount-1 Then
btnNext.Enabled = False
Else
btnNext.Enabled = True
End If
If activepage = 0 Then
btnPrev.Enabled = False
Else
btnPrev.Enabled = True
End If
lblPage.Text = (page+1)&"/"&pagecount
Log("b4a pagerendered ("&page&","&pagecount&")")
img.Bitmap = image
End Sub
Sub btnPrev_Click
If activepage > 0 Then
pdfr.renderPage(activepage-1)
End If
End Sub
Sub btnNext_Click
If activepage < pdfPages Then
pdfr.renderPage(activepage+1)
End If
End Sub
Like with everything else in life, this is another option that one can choose from to work with. Thanks for this @DonManfred!you are right... i did not know that there was already such a lib...
Works well @DonMafred! I love it!Like with everything else in life, this is another option that one can choose from to work with. Thanks for this @DonManfred!
You´re welcomeWorks well @DonMafred! I love it!
I said you should look at the example!I added imageview to the layout as you said.
What ANDROID VERSION doies the device have which you are using?????NoClassDefFoundError: android.graphics.pdf.PdfRenderer
ATTENTION: This library needs Android 5 (Lollipop)!!!
Note that this lib will only work on Android 5+
It will not work on older devices.
no. There is no setting in the lib for the qualityan i get best quality PNG?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?