|
Tutorial - Email |
Top Previous Next |
|
This tutorial guides to e-mail PDF document using PDFtoolkit's runtime setup dialog or programmatically mail the PDF files using 'gtEMailInfoX' and 'gtPDFDocumentX' components.
*Mailing using setup dialog
Follow these steps to e-mail PDF document using PDFtoolkit's runtime setup dialog:
1. Create an application using PDFtoolkit components to generate PDF document. 2. Run the application. This will pop up a runtime setup dialog. 3. Select 'Email' tab to provide the mailing information. Select 'Email After Save' checkbox to activate mailing form. Provide Host, User ID and Password to connect the mailing server. 4. Click 'OK' to send PDF document as attachment.
*Programmatically mailing using PDFtoolkit
Follow these steps to create e-mail application programmatically using PDFtoolkit components.
The information required for the EMail can be provided either through the event or through the EmailInfo property. If Event method is used, then provide a handler for gtPDFDocumentX OnEmail event to set the E-Mail information.
[VB]
Dim emailInfo As gtEmailInfoX gtPDFDocumentX1.EMailAfterSave = True Set emailInfo = gtPDFDocumentX1.emailInfo emailInfo.Host = "host" emailInfo.UserId = "XYZ" emailInfo.Password = "Password" emailInfo.Attachments.Add ("attach1.zip") emailInfo.RecepientsList.Add ("recipient1@domain.com ") emailInfo.FromAddress = "FromAddress.com" emailInfo.Subject = " Hello" emailInfo.CCList.Add ("cc1@domain.com") emailInfo.CCList.Add ("cc2@domain.com") emailInfo.BccList.Add ("bcc1@domain.com") emailInfo.BccList.Add ("bcc2@domain.com") gtPDFDocumentX1.LoadFromFile ("Input.pdf") gtPDFDocumentX1.SaveToFile ("Output.pdf")
[VC++]
CgtEmailInfo TmpEmail; BSTR name; Variant varName; TmpEmail.SetHost("host"); TmpEmail.SetUserId("amith") TmpEmail.SetPassword("password") //TCHAR2BSTR is a utility Function provided In gtPDFkitUtils.h name = TCHAR2BSTR("recipient1@domain.com"); varName.bstrVal = name; varName.vt = VT_BSTR; TmpEmail = m_PDF.GetEmailInfo(); TmpEmail.GetRecepientsList().Add(varName); TmpEmail.SetFromAddress("FromAddress.com "); TmpEmail.SetSubject("Hello"); name = TCHAR2BSTR("cc1@domain.com "); varName.bstrVal = name; TmpEmail.GetCCList().Add(varName); name = TCHAR2BSTR("cc1@domain.com "); varName.bstrVal = name; TmpEmail.GetCCList().Add(varName); name = TCHAR2BSTR("bcc1@domain.com "); varName.bstrVal = name; TmpEmail.GetBccList().Add(varName); name = TCHAR2BSTR("bcc1@domain.com "); varName.bstrVal = name; TmpEmail.GetBccList().Add(varName); m_PDF.SetEMailAfterSave(True); m_PDF.LoadFromFile ("Input.pdf"); m_PDF.SaveToFile ("Output.pdf");
|