Hi All
I spent few hours trying to figure why this code is not working in B4I.
If I load the generated pdf file in a WebView, it shows as it is supposed to look.
If I email it and try to view it on a PC, it is random: sometimes totally empty, other times few labels are displayed, etc... (unpredictable)
I spent few hours trying to figure why this code is not working in B4I.
B4X:
Public Sub PrintTestReceipt() As String
PDFReceiptFile = PDF_MTR_RECEIPT_FILE_NAME
Dim TestFont As Font = Font.CreateNew2( "Courier", 10 )
If File.Exists(File.DirTemp, PDFReceiptFile ) = True Then
File.Delete(File.DirTemp, PDFReceiptFile)
End If
cvs.InitializePDF(File.DirTemp, PDFReceiptFile,612,792)
' For iIndex = 0 To 50
' cvs.DrawLine( 0, iIndex * 10, 200, iIndex * 10, Colors.Black, 1 )
' Next
For iIndex = 0 To 10
Dim TempText As String = "Line_" & iIndex
cvs.DrawText( TempText, 20, iIndex * 10, TestFont, Colors.Black, "LEFT")
Next
'
cvs.Release
PDFFullReceiptFile = File.Combine(File.DirTemp, PDFReceiptFile )
Return PDFFullReceiptFile
End Sub
If I load the generated pdf file in a WebView, it shows as it is supposed to look.
If I email it and try to view it on a PC, it is random: sometimes totally empty, other times few labels are displayed, etc... (unpredictable)
Last edited: