Format.ExportPrintPreviewToImage Method

ClosedDescription

Exports an image for each page of a document's print preview.

ClosedSyntax

Format.ExportPrintPreviewToImage(Directory, FileNameTemplate, FileType, Colors, DPI, backgroundColor, SaveOpts, IncludeMargins, IncludeBorder, Msgs)

Where:

ClosedRequirements

Version

BarTender 9.01 or higher

Edition

Enterprise

ClosedRemarks

The Format.ExportPrintPreviewToImage method exports all objects that are created on the template, with the following exceptions: 

To include these objects, use the Format object's ExportToFile method.

The ExportPrintPreviewToImage method returns the following results:

ClosedVB.NET Example

'Declare a BarTender application variable

Dim btApp As BarTender.Application

'Declare a BarTender document variable

Dim btFormat As BarTender.Format

'Declare a BarTender messages variable

Dim msgs As BarTender.Messages = Nothing

'Create a new instance of BarTender

btApp = New BarTender.Application

'Set the BarTender application to visible

btApp.Visible = True

'Open a BarTender document

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

'Export document to a print preview

Dim res As BarTender.BtPrintResult

res = btFormat.ExportPrintPreviewToImage("c:\", "Label_%PageNumber%_Preview.jpg", "jpg", BarTender.BtColors.btColors24Bit, 200, 13117215, BarTender.BtSaveOptions.btSaveChanges, true, true, msgs)

'End the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

ClosedC# Example

// Declare a BarTender application variable

BarTender.Application btApp;

// Declare a BarTender document variable

BarTender.Format btFormat;

// Declare a BarTender messages variable

BarTender.Messages msgs;

// Create a new instance of BarTender

btApp = new BarTender.Application();

// Set the BarTender application to visible

btApp.Visible = true;

// Open a BarTender document

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

// Export document to a print preview

BarTender.BtPrintResult res;

res = btFormat.ExportPrintPreviewToImage("c:\\", "Label_%PageNumber%_Preview.jpg", "jpg", BarTender.BtColors.btColors24Bit, 200, 13117215, BarTender.BtSaveOptions.btSaveChanges, true, true, out msgs);

// End the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Related Topics