create and email pdf

kamalkishor

Member
Licensed User
Longtime User
hi

I am doing program with creating a PDF and mail it as attached file. But i was failed to create a PDF, any body help me and let me know how to create and mail it. thanx

rgds

Kamal
 

kamalkishor

Member
Licensed User
Longtime User
open a created PDF

Hello Erel,
thanks for reply, I followed your suggestion.

and I am trying following code. As I come to know, I had created PDF but unable to open it. Please check the following code as it will not open my created PDF.

'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.

End Sub

Sub Globals
Dim PDFWriter1 As PDFWriter
Dim PaperSize As PDFPaperSizes
Dim Font As PDFStandardFonts
Dim PDFContent As String
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.

End Sub

Sub Activity_Create(FirstTime As Boolean)
PDFWriter1.Initialize("PDFWriter1",PaperSize.A4_WIDTH, PaperSize.A4_HEIGHT)
Activity.LoadLayout("pdf")
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")

End Sub
Sub PDF_Click
PDFWriter1.addLine(10,200,150,100)
PDFWriter1.addRawContent("[]0 d/n")
PDFWriter1.addText(10,50,20,"pd test")
PDFWriter1.ConverseDocument

Msgbox(File.DirDefaultExternal, "dir")
PDFWriter1.outputToFile(File.DirDefaultExternal,"myNewPDF.pdf",PDFContent,"ISO-8859-1")
Log("PDFWriter1 = " & PDFWriter1)
'PDFWriter1.outputToFile(File.DirDefaultExternal,"myNewPDF.PDF",PDFContent,"ISO-8859-1")
End Sub
Sub PDFWriter1_ConversionDone (Content As String)
PDFContent = Content
ProgressDialogHide
ToastMessageShow("Conversion has been done.",False)
End Sub
Sub readPDF_Click


Dim Intent1 As Intent
Intent1.Initialize(Intent1.ACTION_VIEW,"file://" & File.Combine(File.DirDefaultExternal & "/","myNewPDF.pdf"))

Intent1.SetType("application/pdf")
Intent1.WrapAsIntentChooser("Choose PDF Viewer")
StartActivity(Intent1)
End Sub
Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub.



Please let me know, how can i open or check my created PDF. I already install PDF viewer and adobe reader to my emulator.


thank you


rgds

Kamal
 
Upvote 0

raphael75

Active Member
Licensed User
Longtime User
I have not tested your code, but I just see that the file name is written differently in two different code lines (with and without space):

B4X:
PDFWriter1.outputToFile(File.DirDefaultExternal,"m yNewPDF.pdf",PDFContent,"ISO-8859-1")  ' <== Space in file name

B4X:
Dim Intent1 As Intent
Intent1.Initialize(Intent1.ACTION_VIEW,"file://" & File.Combine(File.DirDefaultExternal & "/","myNewPDF.pdf"))

Is this intentional?
 
Upvote 0
Top