BCL easyPDF SDK
easyPDF SDK Usermanual
PDF Creator Programming API  |  Download Free Trial  |  Contact Us to Purchase

PrintOut Method

Prints a document into a PDF file.

Sub PrintOut(InFileName As String,
             OutFileName As String)

void PrintOut(string InFileName,
              string OutFileName)

void PrintOut(String InFileName,
              String OutFileName) throws PrinterException

Parameters

Return Values

N/A.

Remarks

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:\test\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.

Example Usage

On Error goto Function_Err

Set oPrinter = CreateObject("easyPDF.Printer.8")
Set oPrintJob = oPrinter.PrintJob
oPrintJob.PrintOut "C:\test\input.doc", "C:\test\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