How to create PDF from printable files and then send output PDF directly by C#?

Sometime, we need to convert printable files to PDF for printing, long time preserving or others by self-developed applications like ERP.  In this article, I will share a method of creating PDF from printable PDF file and then send output PDF directly by C#. The software I will is named as VeryDOC Doc Converter COM, by which you can convert files of Microsoft Word, PowerPoint, Excel, JPG, PNG, GIF, HTML and others to PDF by script together with other application like VB, VC, C# etc. Please check more detail information on homepage, in the following part, I will show you how to use this software.

Step 1. Free download and install Doc Converter COM

  • Please download and install PDFcamp Printer v2.3 or PDFcamp Printer Pro v2.3, and then download DocConverter COM from our website.
  • Please unzip "doc2pdf_com_trial.zip" package to a folder, and run "install_as_exe.bat" file to install the DocConverter COM into your system
  • Then you can run HTML2PDF.exe from command line to try, HTML2PDF.exe is a Windows Command Line Tool, you can run it from command line window,For example:html2pdf.exe "http://www.yahoo.com" "C:\yahoo.pdf".

Step 2. Create PDF from printable file and then send output PDF by email directly.

  • When you need to call this COM software together with  other applications like C#, please refer to the following command line templates.
  • The following command line template can help you convert .doc, .xls, .html, .txt, .rtf etc files to PDF files, but it will popup a print dialog when conversion, this is a global function, you need set any value before you call it,
    Private Sub Word2PDF_ShellPrint_Click()
        Set PdfCreator = New PDFOUTLib.PdfCreator
        PdfCreator.Word2PDF "C:\sample.doc", "C:\sample.doc.pdf"
        Debug.Print "C:\sample.doc -->C:\sample.doc.pdf"
        MsgBox "Word2PDF_ShellPrint finished"
        Set PdfCreator = Nothing
    End Sub
  • When you need to send output PDF file to some body by email directly, please refer to the following command line templates. 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 too many functions of this software, I can not list all of them here. If you need to know more functions of this software, please visit homepage or User Manual of Doc Converter COM Component. During the using, if you have any question, please contact us as soon as possible.

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *


Verify Code   If you cannot see the CheckCode image,please refresh the page again!