I have an app that I'm writing to print Lesson Plans for me. Everything is working beautifully (thanks Erel) except....
My Lesson Plan is displayed on my device and includes a .jpg logo and this is shown correctly. In order to print the LP I have to email the file to myself which works well but the image is missing. Below is the code I use to generate the header of the LP. What am I missing please?
the problem is, that the image is linked in your HTML (File:///android_asset/ldlogo.jpg), so if you mail the HTML, there will no image be present. One solution is to embedd the image encoded as Base64.
Sub ImageEncodeBase64(Dir As String, Image As String) As String
Dim su As StringUtils
Dim in As InputStream
in = File.OpenInput(Dir, Image)
Dim out As OutputStream
out.InitializeToBytesArray(1000)
File.Copy2(in, out) '<---- This does the actual copying
Dim data() As Byte
data = out.ToBytesArray
Return su.EncodeBase64(data)
End Sub
the above function I use in B4J, but B4A must be similar...