| Skype: | TextControlSupport | |
| Orders: | 877-462-4772 |

| Author: | TX Text Control Support Department |
| Language: | Visual Basic |
| Version: | 1.1 |
| Released: | September 24, 2002 |
| Last modified: | January 11, 2008 |
| Requirements: | TX Text Control ActiveX with Visual Basic |
| Download code: | pdf_attachment.zip |
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. Our resulting application will look like this:

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 End function
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: