I have come across Foxit PDF creator which is essentially a printer driver which can print out PDF's to file. This is great an all but the Printout()
method doesn't take any arguments (...)
Well, even if you can't pass parameters into
PrintOut()
method, you can print out email to Foxit PDF creator by using
Process.Start() method[
^]. Note: you'll need to save email as a *.doc or *.rtf file first! System will use the default application, which is associated to that file, to open it. So, the default printer should be set to Foxit PDF Creator.
Dim psi As New ProcessStartInfo
PrintPDF.UseShellExecute = True
PrintPDF.Verb = "print"
PrintPDF.WindowStyle = ProcessWindowStyle.Hidden
PrintPDF.FileName = sFullFileName
Process.Start(psi)
For further details about printing documents by using
Process.Start
method, please refer this:
How to Silently Print PDFs using Adobe Reader and C#[
^]
Another way is to print
MailItem.Body[
^] by using
PrintDocument Class (System.Drawing.Printing) | Microsoft Docs[
^]. Then you'll able to print that document directly to Foxit PDF Creator. Note that
Body
returns a string representation of clear-text body of the Outlook item. So, depending on
MailItem.BodyFormat property (Outlook) | Microsoft Docs[
^] you'll get one of three body text formats: Plain Text, Rich Text (RTF), and HTML.