Skype:TextControlSupport
Orders:877-462-4772
TX Text Control - word processing components.
What is this?Syndicate this content

E-Mail TX Text Control's contents, as PDF

This source code snippet requires TX Text Control ActiveX
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 Download [8.65 KB, 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.)

Code Overview

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.

  1. Public Function CreateFileAttachment(tx As TXTextControl) As String
  2. Dim sTempFile As String
  3. sTempFile = App.Path & "\" & Form1.Text1.Text & ".pdf"
  4. Form1.TXTextControl1.Save sTempFile, 0, 12, False
  5. CreateFileAttachment = sTempFile
  6. 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:

http://www.microsoft.com/office/

top

Top 10 Bestselling Product Award 2007Top 25 Publisher Product Award 2007Top 10 Bestselling Product Award 2007 in JapanTop 25 Bestselling Product Award 2006Top 25 Bestselling Publisher Award 2006Reader's Choice Award, dot.net magazin, 3rd place