Creating and emailing PDF as attachment
Posted: Wed Jun 10, 2015 1:25 pm
I am trying to create a PDF file and send it as an attachment in an email. The code I have works OK in IOS but when I run it in Android, the email is created minus the attachment.
I am not quite sure if it is creating the PDF attachment and not attaching it or if its not creating the PDF file. Is there any way I can browse and check if the PDF has been created?.
The code created is below:
global gSalesQualifier_PrimaryeMailAddress, gSalesQualifier_SecondaryeMailAddress, gProjectTitle, gEngineerName, gVisitDate, gUUID
## Load location and file name into PDF path variable
put specialfolderPath("documents") & "/SalesQualifierID " & gUUID & ".pdf" into tPDFPath
## Creat PDB file and store in PDF Print location
set the printScale to 0.95
set the printMargins to "0,0,0,0"
set the printPaperSize to "595,842"
open printing to pdf tPDFPath
print card "SalesQualifier_Print"
close printing
## Create email message and attach stored PDF file
put tPDFPath into tAttachment["file"]
put "PDF" into tAttachment["type"]
put "/Sales Qualifier ID " & gUUID & ".pdf" into tAttachment["name"]
mobileComposeMail "Sales Qualifier Report ID: " & gUUID & " - Title: " & gProjectTitle , gSalesQualifier_PrimaryeMailAddress,gSalesQualifier_SecondaryeMailAddress,, "Please find attached a copy of the Sales Qualifier Report, ID: " & gUUID & " for a sales visit dated " & gVisitDate & " relating to enquiry title " & gProjectTitle & " by " & gEngineerName & ".", tAttachment
## Co back to General Details card on completion of email send.
go card "GeneralDetails1"
close this stack
Can anyone point me in the correct direction.
Thanks
I am not quite sure if it is creating the PDF attachment and not attaching it or if its not creating the PDF file. Is there any way I can browse and check if the PDF has been created?.
The code created is below:
global gSalesQualifier_PrimaryeMailAddress, gSalesQualifier_SecondaryeMailAddress, gProjectTitle, gEngineerName, gVisitDate, gUUID
## Load location and file name into PDF path variable
put specialfolderPath("documents") & "/SalesQualifierID " & gUUID & ".pdf" into tPDFPath
## Creat PDB file and store in PDF Print location
set the printScale to 0.95
set the printMargins to "0,0,0,0"
set the printPaperSize to "595,842"
open printing to pdf tPDFPath
print card "SalesQualifier_Print"
close printing
## Create email message and attach stored PDF file
put tPDFPath into tAttachment["file"]
put "PDF" into tAttachment["type"]
put "/Sales Qualifier ID " & gUUID & ".pdf" into tAttachment["name"]
mobileComposeMail "Sales Qualifier Report ID: " & gUUID & " - Title: " & gProjectTitle , gSalesQualifier_PrimaryeMailAddress,gSalesQualifier_SecondaryeMailAddress,, "Please find attached a copy of the Sales Qualifier Report, ID: " & gUUID & " for a sales visit dated " & gVisitDate & " relating to enquiry title " & gProjectTitle & " by " & gEngineerName & ".", tAttachment
## Co back to General Details card on completion of email send.
go card "GeneralDetails1"
close this stack
Can anyone point me in the correct direction.
Thanks