Hi guys how do I initialize the PdfReader with the blob data taken from the database. I explain, I'm making an app that saves the pdf files on the device in a database as blobs, the problem is that reconverting from byte to bitmap I can not initialize the Pdfreader with the bitmap obtained. I'm trying this way.
B4X:
Sub ListViewPdf_ItemClick (Position As Int, Value As Object)
Dim Cursor3 As Cursor
Dim Name As String
Dim Buffer3() As Byte
Dim IpSt3 As InputStream
Dim Bitmap3 As Bitmap
Dim out As OutputStream
Cursor3=Sql.ExecQuery("SELECT Name,Pdf,Data,ID FROM FilePdf ORDER BY ID DESC")
For i = 0 To ListViewPdf.Size-1
Cursor3.Position =Position
Next
Name = Cursor3.GetString("Name")
Buffer3 = Cursor3.GetBlob("Pdf")
IpSt3.InitializeFromBytesArray(Buffer3,0, Buffer3.Length)
IpSt3.Close
Bitmap3.Initialize2(IpSt3)
pdf.Initialize("",File.DirDefaultExternal,Name&".pdf")
LPages2.Text=pdf.PageCount
LPages2.Tag=pdf.PageCount
LPage2.Text= 1
LPage2.Tag=1
ImageViewP.Gravity=Gravity.FILL
PanelViewPDF.Visible=True
LabelName.Text=Name
ImageViewP.SetBackgroundImage(Bitmap3)
Cursor3.Close
End Sub
Last edited: