This week we are revisiting a previous, very popular newsletter that shows how to send the contents of a TX Text Control via e-mail.
Since the release of TX Text Control ActiveX v10 last Friday, this sample gets a new dimension. Now it is possible to save the content of a TX Text Control document as a PDF file.
The PDF Advantage
Using PDF has the advantage that you can be sure that your document always looks the same regardless of the platform or software reader that is used to view it. This enables you to send the document across the Internet, as an e-mail attachment, with the certainly that what you see is exactly the same as what the recipient will see.
Contrary to HTML, images are embedded in PDF documents. This means that you can embed your company logo, for example, into a quotation and be certain that the recipient will see the quotation, complete with graphical logo - just like you intended. Using HTML for this purpose you would forced to load the graphical logo onto a WWW server. This is tricky and requires the recipient to be online when viewing the quotation. (Something you, as the programmer, cannot control.)
This week, we are going to use the same technique as discussed in the above newsletter to send the contents of a TX Text Control document via e-mail as an attachment to someone on the Internet. To achieve this we are using the MAPISession control from the Microsoft MAPI controls.
Taking the code from the above linked previous newsletter, the only thing we have changed is the file format. The Save method has been used with format identifier 12 to save PDF files.
Public Function CreateFileAttachment(tx As TXTextControl) As String
Dim sTempFile As String
sTempFile = App.Path & "\" & Form1.Text1.Text & ".pdf"
Form1.TXTextControl1.Save sTempFile, 0, 12, False
CreateFileAttachment = sTempFile
Important Notice: Please note that if you use Office 2000 / XP and Outlook as your MAPI client, please install the latest Office service pack. Further details at:
The Newsletter Team