PrintUserParams Class Documentation

classPrintUserParams

Namespace:datalogics_interface

Detailed Description

Two structures provide settings for setting parameters for print jobs, PrintUserParams and PrintParams. PrintUserParams was created first, and then PrintParams was created as an extension of PrintUserParams, to provide more settings to account for changing technology.

When the system seeks to print a document it will pass the content and the print parameters, such as the page size, paper tray, and landscape v. portrait, to the print API in APDFL. If the setting is in PrintParams it will pass the document and parameters to PrintParams and then to PrintUserParams and from there to the print API to complete the printing process.

The print logic may take different code paths depending on whether or not the print content is being sent to a printer or to a file, or if the printing uses PostScript or not. When you see a print setting that appears in both PrintUserParams and PrintParams, such as "ShrinktoFit," set the appropriate value in both of these classes. Also, PrintParams offers a variety of settings related to PostScript, but the use of PrintParams is not limited to PostScript.

Constructor & Destructor Documentation

PrintUserParams

PrintUserParams()

Initializes the print parameters to default values: paper size set to use the media box, emit to printer enabled, emit to file disabled, and zero copies. On macOS, also initializes the system print session, print settings, and page format.

~PrintUserParams

~PrintUserParams()

Member Function Documentation

get_binary_ok

intget_binary_ok()

Returns:

Binary ok setting.

Gets whether to enable Binary data, 1 turns it on and 0 turns it off. It applies to a Postscript printer. This API is available on Windows and macOS only.

get_collate

boolget_collate()

Returns:

True if copies should be collated.

Collate property.

get_device_name

std::stringget_device_name()

Returns:

std::string

The unicode name of the device to print to (for example, "Distiller
Assistant v3.01"). Available devices can be found in the Windows Registry at HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Devices. It applies to a printer.

get_driver_name

std::stringget_driver_name()

Returns:

std::string

The unicode name of the driver (for example, "winspool"). See the registry key for deviceName. It applies to the printer.

get_emit_to_file

boolget_emit_to_file()

Returns:

true if a PostScript file is created.

Gets whether a Postscript file is created.

get_emit_to_printer

boolget_emit_to_printer()

Returns:

true if output to a printer.

Gets whether to Output the PDF document to a Postscript Printer.

get_end_page

intget_end_page()

Returns:

the page to end upon

Gets the page on which to finish printing, using zero-based nubmering. It applies to a printer. This API is only available on Windows and macOS only.

get_in_file_name

std::stringget_in_file_name()

Returns:

std::string

Unicode name used for the Windows DOCINFO structure (lpszDocName) that points to a NULL-terminated string that specifying the name of the document. In case of printing/exporting to Postscript, this field sets the Title DSC comment in the generated Postscript file. If inFileName was not provided, the Title DSC comment is filled with the name of pdf document.

get_n_copies

intget_n_copies()

Returns:

the number of copies that will be printed

Gets the number of copies to print. It applies to a Postscript file.

get_out_file_name

std::stringget_out_file_name()

Returns:

std::string

Unicode name used for the Windows DOCINFO structure (lpszOutput). It points to a NULL-terminated string that specifies the name of an output file. If this pointer is NULL, the output will be sent to the device identified by deviceName, driverName, and portName. It applies to a printer.

get_paper_height

unsigned shortget_paper_height()

Returns:

the height of the paper in points

Gets the Height of paper in points. The default value is 792. It applies to a Postscript printer.

get_paper_width

unsigned shortget_paper_width()

Returns:

the width of the paper in points

Gets the Width of paper in points. The default value is 612. It applies to a Postscript printer.

get_port_name

std::stringget_port_name()

Returns:

std::string

The unicode name of the port (for example, "Ne00"). See the registry key for deviceName. It applies to the printer.

get_print_annots

intget_print_annots()

Returns:

1 if annotations will be printed, 0 if not

Gets the printing annotations setting, 1 turns it on, 0 turns it off. It applies to a printer. This API is available on Windows and macOS only.

get_ps_level

intget_ps_level()

Returns:

Postscript level setting

Gets the Postscript level. It applies to a Postscript printer. This API is available on Windows and macOS only.

get_reverse

intget_reverse()

Returns:

1 to reverse page order or 0 for regular order

Gets whether to reverses print order, 1 reverses it and 0 does regular order. It applies to a printer. This API is available on Windows and macOS only.

get_shrink_to_fit

boolget_shrink_to_fit()

Returns:

true if the page will be shrunk to fit

Gets the Shrink to fit setting, true turns it on, false turns it off. It applies to a Postscript printer. This API is available on Windows and macOS only.

get_start_page

intget_start_page()

Returns:

the start page

Gets the page to start printing with, using zero-based numbering. It applies to a printer. This API is only available on Windows and macOS only.

get_trans_quality

intget_trans_quality()

Returns:

the transparency flatting quality, 1 is fastest; 5 is best

Gets the Transparency flattening quality control. 1 is fastest; 5 is best. The default is 3. It applies to a printer. This API is available on Windows only.

set_binary_ok

voidset_binary_ok(intvalue)

Parameters

value: int

Binary Ok setting.

Returns:

void

Sets whether to enable Binary datam, 1 turns it on and 0 turns it off. It applies to a Postscript printer. This API is available on Windows and macOS only.

set_collate

voidset_collate(boolvalue)

Parameters

value: bool

True if need to collate copies.

Returns:

void

These private functions are used to keep the DevMode (or Mac PMSession/Settings/Etc) in 'sync': all relevant fields in both structures should agree on common settings at the moment PDFLPrintDoc() (in CDocument) is called. This synchronization is necessary because DevMode settings can change outside of DLE's direct control (e.g. print dialog box).

UpdateDevModeAndNamesFromPrintDlgInternal(): Updates the DevMode and DevNames with handles pulled from a PRINTDLG UpdateDevModeFromPrintUserParamsInternal(): Updates the DevMode with values from the current PrintUserParams UpdatePrintUserParamsFromDevModeInternal(): Updates the PrintUserParams with values from the current DevMode

set_device_name

voidset_device_name(const std::string &name)

Parameters

name: const std::string &

the device name

Returns:

void

set_driver_name

voidset_driver_name(const std::string &name)

Parameters

name: const std::string &

the driver name

Returns:

void

set_emit_to_file

voidset_emit_to_file(boolvalue)

Parameters

value: bool

pass true to emit output to a PostScript file

Returns:

void

Sets whether a Postscript file is created. You set either this parameter or emitToPrinter, but not both.

set_emit_to_printer

voidset_emit_to_printer(boolvalue)

Parameters

value: bool

pass true to emit to the printer

Returns:

void

Sets whether to Output the PDF document to a Postscript Printer. Set either this parameter or emitToFile, but not both.

set_end_page

voidset_end_page(intpage)

Parameters

page: int

the page to end upon

Returns:

void

Sets the page on which to finish printing, using zero-based nubmering. It applies to a printer. This API is only available on Windows and macOS only.

set_in_file_name

voidset_in_file_name(const std::string &name)

Parameters

name: const std::string &

the input file name used as the Title DSC comment in the generated Postscript file.

Returns:

void

set_n_copies

voidset_n_copies(intcopies)

Parameters

copies: int

the number of copies to print.

Returns:

void

Sets the number of copies to print. It applies to a Postscript file.

set_out_file_name

voidset_out_file_name(const std::string &name)

Parameters

name: const std::string &

the out file name

Returns:

void

set_paper_height

voidset_paper_height(unsigned shortheight)

Parameters

height: unsigned short

the height of the paper in points

Returns:

void

Sets the Height of paper in points. The default value is 792. It applies to a Postscript printer.

set_paper_width

voidset_paper_width(unsigned shortwidth)

Parameters

width: unsigned short

the width of the paper in points

Returns:

void

Sets the Width of paper in points. The default value is 612. It applies to a Postscript printer.

set_port_name

voidset_port_name(const std::string &name)

Parameters

name: const std::string &

the port name

Returns:

void

set_print_annots

voidset_print_annots(intvalue)

Parameters

value: int

1 to print annotations, 0 to not print them.

Returns:

void

Sets the printing annotations setting, 1 turns it on, 0 turns it off. It applies to a printer. This API is available on Windows and macOS only.

set_ps_level

voidset_ps_level(intlevel)

Parameters

level: int

Postscript Level setting.

Returns:

void

Sets the Postscript level. It applies to a Postscript printer. This API is available on Windows and macOS only.

set_reverse

voidset_reverse(intvalue)

Parameters

value: int

1 to reverse page order or 0 for regular order

Returns:

void

Sets whether to reverses print order, 1 reverses it and 0 does regular order. It applies to a printer. This API is available on Windows and macOS only.

set_shrink_to_fit

voidset_shrink_to_fit(boolvalue)

Parameters

value: bool

pass true to shrink the page to fit

Returns:

void

Sets the Shrink to fit setting, true turns it on, false turns it off. It applies to a PostScript printer. This API is available on Windows and macOS only.

set_start_page

voidset_start_page(intpage)

Parameters

page: int

the page to start on

Returns:

void

Sets the page to start printing with, using zero-based numbering. It applies to a printer. This API is only available on Windows and macOS only.

set_trans_quality

voidset_trans_quality(intquality)

Parameters

quality: int

the transparency flatting quality, 1 is fastest; 5 is best

Returns:

void

Sets the Transparency flattening quality control. 1 is fastest; 5 is best. The default is 3. It applies to a printer. This API is available on Windows only.