I want to create a pdf file from an url. The url contains image and barcode. The url could be sent to printer then print or save as pdf without problem.
But I want to create pdf without showing the printer screen. I tried the following but always got blank pdf. Any hints?
But I want to create pdf without showing the printer screen. I tried the following but always got blank pdf. Any hints?
B4X:
wv_pdf.LoadUrl(argurl)
Wait For wv_pdf_PageFinished (Url As String)
Dim lpdf As PdfDocument
lpdf.Initialize
lpdf.StartPage(595,842) ' a4
Dim lbmp As Bitmap
lbmp = wv_pdf.CaptureBitmap
Dim lrect As Rect
lrect.Initialize(0,0,595,842)
lpdf.Canvas.DrawBitmap(lbmp, lrect, lrect)
lpdf.FinishPage
gRp.CheckAndRequest(gRp.PERMISSION_WRITE_EXTERNAL_STORAGE)
Wait For Activity_PermissionResult (Permission As String, result As Boolean)
If result Then
Dim outs As OutputStream = File.OpenOutput(File.DirInternal, argfilename, False)
lpdf.WriteToStream(outs)
outs.Close
End If
lpdf.Close