good morning How could I write the content of textengine in pdf Sorry but I don't have much experience with this library and I didn't find anything in the forum thanks
good morning How could I write the content of textengine in pdf Sorry but I don't have much experience with this library and I didn't find anything in the forum thanks
BBCodeView1.LazyLoading = False
(...)
Dim imagen As B4XBitmap = BBCodeView1.ForegroundImageView.GetBitmap
Dim Out As OutputStream
Out = File.OpenOutput(Starter.rp.GetSafeDirDefaultExternal(""), "pagina1.png", False)
imagen.WriteToStream(Out, 100, "PNG")
Out.Close
but I get a black background in the image.
I'm using the BCTextEngine Example and changed the colordrawable of BBCodeView to white.
What could be the problem and how I can fix it?
This is expected. The text is drawn without any background on ForegroundImageView.
Create a B4XCanvas. Draw the background and then draw ForegroundImageView.GetBitmap.
Can you help with the code. I don't know how to do this.
The code below raises an error: java.lang.ClassCastException: android.graphics.Bitmap cannot be cast to android.view.View
B4X:
Dim c As B4XCanvas
Dim x As B4XView = BBCodeView1.ForegroundImageView.GetBitmap
c.Initialize(x)
Dim b As B4XBitmap = c.CreateBitmap
b.WriteToStream(File.OpenOutput(img_dir, img_name, False), 80, "JPEG")
I don't understand, yet. My code still gets a black background:
B4X:
Dim b As Bitmap = BBCodeView1.ForegroundImageView.Snapshot 'get the size to set the panel
Dim c As B4XCanvas
Dim p As B4XView = xui.CreatePanel("")
p.SetLayoutAnimated(0, 0, 0, b.width, b.height)
c.Initialize(p)
Dim r As B4XRect
r.Initialize(0, 0, b.Width, b.Height)
c.DrawBitmap(BBCodeView1.ForegroundImageView.GetBitmap, r)
Dim b1 As B4XBitmap = c.CreateBitmap
b1.WriteToStream(File.OpenOutput(img_dir, img_nome, False), 80, "JPEG")
That's true. Only the text is drawn on ForegroundImageView. The images and other views are added as views to the internal ScrollView. With some work, you can get the views positions and draw them on the canvas.