In this article, I will show you how to create PDF and then send output PDF by email directly programmatically. The whole process could be under under computer, server or any other net website word as the software I use here is COM version, which you can call it together with any programming or scripting languages, such as Visual Basic, C/C++, Delphi, ASP, PHP, C#, .NET, etc. It is VeryDOC Doc Converter COM, by which we can also create PDF from any printable files like web pages and DOC, RTF, TXT, PPT, XLS. If you need, when finish creating, output PDF will be sent to your client by email directly. Please check more related information of this software on homepage, in the following part, let us check how to use this software.
Step 1. Download Doc Converter COM
- This is COM software, there are pdfout.dll, install_as_service.bat, doc2pdf_service.exe and others included in this software.
- When downloading finishes, there is a zip file. Please extract it to some folder then you can find those elements in the extracted folder.
- Please check how to install them in Manual file.
Step 2. Create PDF and send output PDF by email directly
- When you use this software, please refer to the usage and example of this software.
- For creating PDF, please refer to the following code template:
- When send output PDF file to client by email, please refer to the following code template.
CreatePDF()
Create PDF file,
For Example,
Set PdfCreator = New PDFOUTLib.PdfCreator
PdfCreator.HTML2PDF = "C:\sample.html"
PdfCreator.FileName = "C:\sample.pdf"
PdfCreator.HeadersFooters = "off"
PdfCreator.paperType = 6 '//7 is A4 paper, 6 is A3 paper
PdfCreator.CreatePDF
While PdfCreator.StillRunning = 1
DoEvents
Call WaitMessage
Wend
Set PdfCreator = Nothing
Debug.Print "C:\sample.html -->C:\sample.pdf"
By the above code template, we can create PDF form HTML file and specify output paper size.
After create a PDF file and send it from your mail client,
For Example,
Set PdfCreator = New PDFOUTLib.PdfCreator
PdfCreator.HTML2PDF = "C:\sample.html"
PdfCreator.FileName = "C:\sample.pdf"
PdfCreator.HeadersFooters = "off"
PdfCreator.paperType = 6 '//7 is A4 paper, 6 is A3 paper
PdfCreator.subject = "I can control the subject this way"
PdfCreator.body = "And I can control the body too"
PdfCreator.SendEmail
While PdfCreator.StillRunning = 1
DoEvents
Call WaitMessage
Wend
Set PdfCreator = Nothing
There are lots of functions of this software I can not list all of them here. So please check more on the user manual. During the using, if you have any question, please contact us as soon as possible.