Prints a document into a PDF file.
Sub PrintOut(InFileName As String,
OutFileName As String)
N/A.
An Error is raised if conversion is not successful. You
can obtain detailed information once you catch the error.
Note: If you are printing an HTML file located on local
drive (i.e., "C:\input.htm"), then all links that points to
external objects (such as images, style sheets) must be specified
with absolute path (or using BASE tag), or the document will not be
printed correctly.
On Error goto Function_Err
Set oPrinter = CreateObject("easyPDF.Printer.6")
Set oPrintJob = oPrinter.PrintJob
oPrintJob.PrintOut "C:\input.doc", "C:\output.pdf"
Function_End:
Exit Function
Function_Err:
' Get error message
MsgBox Err.Description
' Look at the error number
If Err.Number = PRN_R_CONVERSION_FAILED Then
' More detailed error message
MsgBox "Conversion Result: " + oPrintJob.ConversionResultMessage
' See if we have error message from printer driver
nResult = oPrintJob.ConversionResult
If nResult = PRN_CR_CONVERSION Or _
nResult = PRN_CR_CONVERSION_INIT Or _
nResult = PRN_CR_CONVERSION_PRINT Then
' Error message from printer driver
MsgBox "Printer Result: " + oPrintJob.PrinterResultMessage
' You can also get the result in integer form
nPrinterResult = oPrintJob.PrinterResult
End If
End If
Resume Function_End