PrintUserParams Class Documentation
class PrintUserParamsNamespace:datalogics_interface
Detailed Description
A structure used to set parameters for print jobs.
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()Constructs a PrintUserParams with default settings.
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(PrintUserParams && )Parameters
~PrintUserParams
~PrintUserParams()Member Function Documentation
get_binary_ok
int get_binary_ok()Returns:
intBinary 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
bool get_collate()Returns:
boolTrue if copies should be collated.
Collate property.
get_device_name
std::string get_device_name()Returns:
std::stringThe 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::string get_driver_name()Returns:
std::stringThe unicode name of the driver (for example, "winspool"). See the registry key for deviceName. It applies to the printer.
get_emit_to_file
bool get_emit_to_file()Returns:
booltrue if a PostScript file is created.
Gets whether a Postscript file is created.
get_emit_to_printer
bool get_emit_to_printer()Returns:
booltrue if output to a printer.
Gets whether to Output the PDF document to a Postscript Printer.
get_end_page
int get_end_page()Returns:
intthe 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::string get_in_file_name()Returns:
std::stringUnicode 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
int get_n_copies()Returns:
intthe 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::string get_out_file_name()Returns:
std::stringUnicode 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 short get_paper_height()Returns:
unsigned shortthe 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 short get_paper_width()Returns:
unsigned shortthe 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::string get_port_name()Returns:
std::stringThe unicode name of the port (for example, "Ne00"). See the registry key for deviceName. It applies to the printer.
get_print_annots
int get_print_annots()Returns:
int1 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
int get_ps_level()Returns:
intPostscript level setting
Gets the Postscript level. It applies to a Postscript printer. This API is available on Windows and macOS only.
get_reverse
int get_reverse()Returns:
int1 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
bool get_shrink_to_fit()Returns:
booltrue 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
int get_start_page()Returns:
intthe 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
int get_trans_quality()Returns:
intthe 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.
operator=
PrintUserParams & operator=(PrintUserParams && )Parameters
Returns:
PrintUserParams &set_binary_ok
void set_binary_ok(int value)Parameters
value: intBinary Ok setting.
Returns:
voidSets 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
void set_collate(bool value)Parameters
value: boolTrue if need to collate copies.
Returns:
voidCollate property.
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
void set_device_name(const std::string & name)Parameters
name: const std::string &the device name
Returns:
voidset_driver_name
void set_driver_name(const std::string & name)Parameters
name: const std::string &the driver name
Returns:
voidset_emit_to_file
void set_emit_to_file(bool value)Parameters
value: boolpass true to emit output to a PostScript file
Returns:
voidSets whether a Postscript file is created. You set either this parameter or emitToPrinter, but not both.
set_emit_to_printer
void set_emit_to_printer(bool value)Parameters
value: boolpass true to emit to the printer
Returns:
voidSets whether to Output the PDF document to a Postscript Printer. Set either this parameter or emitToFile, but not both.
set_end_page
void set_end_page(int page)Parameters
page: intthe page to end upon
Returns:
voidSets 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
void set_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:
voidset_n_copies
void set_n_copies(int copies)Parameters
copies: intthe number of copies to print.
Returns:
voidSets the number of copies to print. It applies to a Postscript file.
set_out_file_name
void set_out_file_name(const std::string & name)Parameters
name: const std::string &the out file name
Returns:
voidset_paper_height
void set_paper_height(unsigned short height)Parameters
height: unsigned shortthe height of the paper in points
Returns:
voidSets the Height of paper in points. The default value is 792. It applies to a Postscript printer.
set_paper_width
void set_paper_width(unsigned short width)Parameters
width: unsigned shortthe width of the paper in points
Returns:
voidSets the Width of paper in points. The default value is 612. It applies to a Postscript printer.
set_port_name
void set_port_name(const std::string & name)Parameters
name: const std::string &the port name
Returns:
voidset_print_annots
void set_print_annots(int value)Parameters
value: int1 to print annotations, 0 to not print them.
Returns:
voidSets 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
void set_ps_level(int level)Parameters
level: intPostscript Level setting.
Returns:
voidSets the Postscript level. It applies to a Postscript printer. This API is available on Windows and macOS only.
set_reverse
void set_reverse(int value)Parameters
value: int1 to reverse page order or 0 for regular order
Returns:
voidSets 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
void set_shrink_to_fit(bool value)Parameters
value: boolpass true to shrink the page to fit
Returns:
voidSets 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
void set_start_page(int page)Parameters
page: intthe page to start on
Returns:
voidSets 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
void set_trans_quality(int quality)Parameters
quality: intthe transparency flatting quality, 1 is fastest; 5 is best
Returns:
voidSets 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.