Page 1 of 1

Creating and emailing PDF as attachment

Posted: Wed Jun 10, 2015 1:25 pm
by ewansmac
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

Re: Creating and emailing PDF as attachment

Posted: Wed Jun 10, 2015 1:34 pm
by jmburnod
Hi,
No experience with androïd but

Code: Select all

put (there is a file tPDFPath)
return true/false on iOS
Best regards
Jean-Marc

Re: Creating and emailing PDF as attachment

Posted: Wed Jun 10, 2015 3:37 pm
by ewansmac
Thanks Jean-Marc,

The answer is no using your advice, it would appear that the PDF has not been created.

On further investigation, I have discovered that the command 'open printing to pdf' is not supported in Android, do you have any advice how to create a PDF in Android.

Thanks