Format.Print Method

ClosedDescription

Prints a BarTender document and optionally waits for printing to finish.

ClosedSyntax

Format.Print(PrintJobName, WaitForJobToComplete, TimeoutMs, Messages)

Where the following parameters are optional:

ClosedRequirements

Version

BarTender 8.01 or higher

Edition

Automation, Enterprise

ClosedRemarks

The Format.Print method returns a Messages collection of Message objects that provide print job status.

The Format.Print method returns one of the following enumerated values.

Constant

Value

Description

BtPrintResult.btSuccess

0

The job was printed successfully.

BtPrintResult.btTimeout

1

The job exceeded the timeout period before it finished.

BtPrintResult.btFailure

2

The job failed to print successfully.

ClosedVB.NET Example

'Declare BarTender variables

Dim btApp As BarTender.Application

Dim btFormat As BarTender.Format

Dim btPrintRtn As BarTender.BtPrintResult

Dim btMsgs As BarTender.Messages = Nothing

'Create a new instance of BarTender

btApp = New BarTender.Application

'Set the BarTender application visible

btApp.Visible = True

'Open a BarTender document

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Print the document

btPrintRtn = btFormat.Print("Job1", True, -1, btMsgs)

'Check to see if there are any error messages

Dim msg As BarTender.Message

If (btPrintRtn <> BarTender.btPrintResult.btSuccess) Then

For Each msg In btMsgs

MessageBox.Show(msg.Message)

Next msg

End If

'End the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

ClosedC# Example

// Declare BarTender variables

BarTender.Application btApp;

BarTender.Format btFormat;

BarTender.BtPrintResult btPrintRtn;

BarTender.Messages btMsgs;

// Create a new instance of BarTender

btApp = new BarTender.Application();

// Set the BarTender application visible

btApp.Visible = true;

// Open a BarTender document

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

// Print the document

btPrintRtn = btFormat.Print("Job1", true, -1, out btMsgs);

// Check to see if there are any error messages

if (btPrintRtn != BarTender.BtPrintResult.btSuccess)

{

foreach(BarTender.Message msg in btMsgs)

{

MessageBox.Show(msg.Message);

}

}

// End the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Related Topics