Format.ExportPrintPreviewRangeToImage Method

ClosedDescription

Exports an image for specified pages of a document's print preview.

ClosedSyntax

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

Where:

ClosedRequirements

Version

BarTender 9.4 or higher

Edition

Enterprise

ClosedRemarks

The Format.ExportPrintPreviewRangeToImage 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 ExportPrintPreviewRangeToImage 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 pages 1, 3, 4, and 5 to a print preview

Dim res As BarTender.BtPrintResult

res = btFormat.ExportPrintPreviewRangeToImage("1,3-5", "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 pages 1, 3, 4, and 5 to a print preview

BarTender.BtPrintResult res;

res = btFormat.ExportPrintPreviewRangeToImage("1,3-5", "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