# PrintUserParams Class

> A structure used to set parameters for print jobs.

- Product: Adobe PDF Library 18
- Language: Java
- Version: APDFL18.0.5PlusP2e
- HTML page: https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/PrintUserParams
- Version index: https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/llms.txt

```java
class PrintUserParams
```

**Namespace:** `com::datalogics::PDFL`

## 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.

**Referenced by:** [`Document`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Document.md)

**Uses types:** [`Document`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Document.md), [`PrintParams`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/PrintParams.md)

## Constructors

### PrintUserParams

```java
com.datalogics.PDFL.PrintUserParams.PrintUserParams()
```

*constructor*

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.

## Fields

### USE_CROP_BOX

```java
static final int com.datalogics.PDFL.PrintUserParams.USE_CROP_BOX
```

*static*

When paper height and width are initialized to this value the crop box of each individual page will be used to determine the paper size.

### USE_MEDIA_BOX

```java
static final int com.datalogics.PDFL.PrintUserParams.USE_MEDIA_BOX
```

*static*

When paper height and width are initialized to this value the printed product more closely resembles what comes out of most PDF Viewers. This can eliminate some print problems, including PCL blank page problems.

## Methods

### choosePaperSourceBySize

```java
void com.datalogics.PDFL.PrintUserParams.choosePaperSourceBySize(double width, double height)
```

**Parameters**

- `width` (`double`): the desired width of the output in user units
- `height` (`double`): the desired height of the output in user units

**Returns:** `void`

Choose the best paper source for a given width and height.

Searches the printer's paper list for the smallest paper size that is greater than or equal to the given width and height, including with rotation, and sets up the job to print with that paper size.

To obtain width and height, specify the Right - Left and Top - Bottom of the MediaBox of a representative Page.

The printerName and portName must be set.

If you use this call in conjunction with PosePrintDialog, UseDefaultPrinter, or UpdateFromPrinterSettings, call this function after those functions.

Setting RotateAndCenter to True is recommended with this function.

### delete

```java
synchronized void com.datalogics.PDFL.PrintUserParams.delete(Boolean disposing)
```

*protected*

**Parameters**

- `disposing` (`Boolean`)

**Returns:** `synchronized void`

### delete

```java
synchronized void com.datalogics.PDFL.PrintUserParams.delete()
```

**Returns:** `synchronized void`

### enumeratePaperSources

```java
java.util.List< String > com.datalogics.PDFL.PrintUserParams.enumeratePaperSources()
```

**Returns:** `java.util.List< String >`

Set of the tray/bin names.

Enumerates available tray/bin names for the specified printer.

### finalize

```java
void com.datalogics.PDFL.PrintUserParams.finalize()
```

*protected*

**Returns:** `void`

### getBinaryOK

```java
int com.datalogics.PDFL.PrintUserParams.getBinaryOK()
```

**Returns:** `int`

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.

### getCollate

```java
boolean com.datalogics.PDFL.PrintUserParams.getCollate()
```

**Returns:** `boolean`

True if copies should be collated.

Collate property.

### getCommand

```java
String com.datalogics.PDFL.PrintUserParams.getCommand()
```

**Returns:** `String`

command line arguments

Gets the Optional command line arguments on Unix. It is used only if emitToPrinter is true. For example, "lp" or "lpr" applies to a Postscript printer. This API is available on Unix only.

### getDeviceName

```java
String com.datalogics.PDFL.PrintUserParams.getDeviceName()
```

**Returns:** `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.

### getDoOPP

```java
int com.datalogics.PDFL.PrintUserParams.getDoOPP()
```

**Returns:** `int`

1 if OverPrint Preview will be used, 0 if not

Gets the OverPrint Preview setting, 1 uses it, 0 does not. It applies to a printer. The default is 0. This API is available on Windows and macOS only.

### getDriverName

```java
String com.datalogics.PDFL.PrintUserParams.getDriverName()
```

**Returns:** `String`

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

### getEmitHalftones

```java
int com.datalogics.PDFL.PrintUserParams.getEmitHalftones()
```

**Returns:** `int`

1 if halftones will be emitted, 0 if not

Gets the Emit half-tones setting, 1 turns it on, 0 turns it off. It applies to a Postscript printer. This API is available on Windows and macOS only.

### getEmitToFile

```java
boolean com.datalogics.PDFL.PrintUserParams.getEmitToFile()
```

**Returns:** `boolean`

true if a PostScript file is created.

Gets whether a Postscript file is created.

### getEmitToPrinter

```java
boolean com.datalogics.PDFL.PrintUserParams.getEmitToPrinter()
```

**Returns:** `boolean`

true if output to a printer.

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

### getEndPage

```java
int com.datalogics.PDFL.PrintUserParams.getEndPage()
```

**Returns:** `int`

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.

### getFarEastFontOpt

```java
FarEastFont com.datalogics.PDFL.PrintUserParams.getFarEastFontOpt()
```

**Returns:** `FarEastFont`

a PDFarEastFont value that represents the setting to be used

Gets the Far East Font setting. The default value is DownloadAll. PrintAsImage will not be honored. It applies to a Postscript printer. This API is available on Windows only.

### getInFileName

```java
String com.datalogics.PDFL.PrintUserParams.getInFileName()
```

**Returns:** `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.

### getNCopies

```java
int com.datalogics.PDFL.PrintUserParams.getNCopies()
```

**Returns:** `int`

the number of copies that will be printed

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

### getOutFileName

```java
String com.datalogics.PDFL.PrintUserParams.getOutFileName()
```

**Returns:** `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.

### getPaperHeight

```java
int com.datalogics.PDFL.PrintUserParams.getPaperHeight()
```

**Returns:** `int`

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.

### getPaperSource

```java
int com.datalogics.PDFL.PrintUserParams.getPaperSource()
```

**Returns:** `int`

Value in DEVMODE->dmDefaultSource if initialized or index of selected paper tray or -1 if not specified.

Paper source property.

### getPaperWidth

```java
int com.datalogics.PDFL.PrintUserParams.getPaperWidth()
```

**Returns:** `int`

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.

### getPortName

```java
String com.datalogics.PDFL.PrintUserParams.getPortName()
```

**Returns:** `String`

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

### getPrintAnnots

```java
int com.datalogics.PDFL.PrintUserParams.getPrintAnnots()
```

**Returns:** `int`

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.

### getPrintParams

```java
PrintParams com.datalogics.PDFL.PrintUserParams.getPrintParams()
```

**Returns:** [`PrintParams`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/PrintParams.md)

the print parameter settings

Gets the Print Parameter settings.

### getPsLevel

```java
int com.datalogics.PDFL.PrintUserParams.getPsLevel()
```

**Returns:** `int`

Postscript level setting

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

### getReverse

```java
int com.datalogics.PDFL.PrintUserParams.getReverse()
```

**Returns:** `int`

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.

### getShrinkToFit

```java
boolean com.datalogics.PDFL.PrintUserParams.getShrinkToFit()
```

**Returns:** `boolean`

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.

### getStartPage

```java
int com.datalogics.PDFL.PrintUserParams.getStartPage()
```

**Returns:** `int`

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.

### getStartResult

```java
int com.datalogics.PDFL.PrintUserParams.getStartResult()
```

**Returns:** `int`

the Spooler ID

Gets the Spooler ID from StartDoc. This API is available on Windows and Unix only.

### getTransQuality

```java
int com.datalogics.PDFL.PrintUserParams.getTransQuality()
```

**Returns:** `int`

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.

### getUseCustomPaperSize

```java
boolean com.datalogics.PDFL.PrintUserParams.getUseCustomPaperSize()
```

**Returns:** `boolean`

true if force.

Gets whether to force the use of the paper size provided in the PaperWidth and PaperHeight parameters and not search for best fit size provided by printer. SetPageSize must also be set.

### paperSourceIdByName

```java
int com.datalogics.PDFL.PrintUserParams.paperSourceIdByName(String trayName)
```

**Parameters**

- `trayName` (`String`): the tray/bin's name whose number need to obtain.

**Returns:** `int`

Tray/Bin number corresponding to the specified name.

Obtain tray/bin number by its name.

### posePrintDialog

```java
boolean com.datalogics.PDFL.PrintUserParams.posePrintDialog(Document doc)
```

**Parameters**

- `doc` ([`Document`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Document.md)): a Document which will be used to set the maximum page range in the dialog box.

**Returns:** `boolean`

true if the user accepted the dialog box, false if it was cancelled

Set the print parameters by posing a dialog box to the user. The parameters set include the printer, page range, paper size, number of copies, and duplexing mode.

Changes to these parameters made by the user will be copied into the corresponding PrintUserParams fields. If you want to override the user's choices, change these fields after calling PosePrintDialog().

### setBinaryOK

```java
void com.datalogics.PDFL.PrintUserParams.setBinaryOK(int binaryOK)
```

**Parameters**

- `binaryOK` (`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.

### setCollate

```java
void com.datalogics.PDFL.PrintUserParams.setCollate(boolean collate)
```

**Parameters**

- `collate` (`boolean`): True if need to collate copies.

**Returns:** `void`

Collate property.

### setCommand

```java
void com.datalogics.PDFL.PrintUserParams.setCommand(String command)
```

**Parameters**

- `command` (`String`): the optional command line arguments

**Returns:** `void`

Sets the Optional command line arguments on Unix. It is used only if emitToPrinter is true. For example, "lp" or "lpr" applies to a Postscript printer. This API is available on Unix only.

### setDeviceName

```java
void com.datalogics.PDFL.PrintUserParams.setDeviceName(String inStr)
```

**Parameters**

- `inStr` (`String`)

**Returns:** `void`

### setDoOPP

```java
void com.datalogics.PDFL.PrintUserParams.setDoOPP(int doOPP)
```

**Parameters**

- `doOPP` (`int`): 1 if OverPrint Preview will be used, 0 if not

**Returns:** `void`

Sets the OverPrint Preview setting, 1 uses it, 0 does not. The default is 0. It applies to a printer. This API is available on Windows and macOS only.

### setDriverName

```java
void com.datalogics.PDFL.PrintUserParams.setDriverName(String inStr)
```

**Parameters**

- `inStr` (`String`)

**Returns:** `void`

### setEmitHalftones

```java
void com.datalogics.PDFL.PrintUserParams.setEmitHalftones(int emitHalftones)
```

**Parameters**

- `emitHalftones` (`int`): 1 if halftones will be emitted, 0 if not

**Returns:** `void`

Sets the Emit half-tones setting, 1 turns it on, 0 turns it off. It applies to a Postscript printer. This API is available on Windows and macOS only.

### setEmitToFile

```java
void com.datalogics.PDFL.PrintUserParams.setEmitToFile(boolean emitToFile)
```

**Parameters**

- `emitToFile` (`boolean`): 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.

### setEmitToPrinter

```java
void com.datalogics.PDFL.PrintUserParams.setEmitToPrinter(boolean emitToPrinter)
```

**Parameters**

- `emitToPrinter` (`boolean`): 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.

### setEndPage

```java
void com.datalogics.PDFL.PrintUserParams.setEndPage(int endPage)
```

**Parameters**

- `endPage` (`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.

### setFarEastFontOpt

```java
void com.datalogics.PDFL.PrintUserParams.setFarEastFontOpt(FarEastFont farEastFontOpt)
```

**Parameters**

- `farEastFontOpt` (`FarEastFont`): a PDFarEastFont value that represents the setting to be used

**Returns:** `void`

Sets the Far East Font setting. The default value is DownloadAll. PrintAsImage will not be honored. It applies to a Postscript printer. This API is available on Windows only.

### setInFileName

```java
void com.datalogics.PDFL.PrintUserParams.setInFileName(String inStr)
```

**Parameters**

- `inStr` (`String`)

**Returns:** `void`

### setNCopies

```java
void com.datalogics.PDFL.PrintUserParams.setNCopies(int nCopies)
```

**Parameters**

- `nCopies` (`int`): the number of copies to print.

**Returns:** `void`

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

### setOutFileName

```java
void com.datalogics.PDFL.PrintUserParams.setOutFileName(String inStr)
```

**Parameters**

- `inStr` (`String`)

**Returns:** `void`

### setPaperHeight

```java
void com.datalogics.PDFL.PrintUserParams.setPaperHeight(int paperHeight)
```

**Parameters**

- `paperHeight` (`int`): 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.

### setPaperSource

```java
void com.datalogics.PDFL.PrintUserParams.setPaperSource(int PaperSource)
```

**Parameters**

- `PaperSource` (`int`): paper source which must be selected.

**Returns:** `void`

Paper source property.

### setPaperWidth

```java
void com.datalogics.PDFL.PrintUserParams.setPaperWidth(int paperWidth)
```

**Parameters**

- `paperWidth` (`int`): 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.

### setPortName

```java
void com.datalogics.PDFL.PrintUserParams.setPortName(String inStr)
```

**Parameters**

- `inStr` (`String`)

**Returns:** `void`

### setPrintAnnots

```java
void com.datalogics.PDFL.PrintUserParams.setPrintAnnots(int printAnnots)
```

**Parameters**

- `printAnnots` (`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.

### setPsLevel

```java
void com.datalogics.PDFL.PrintUserParams.setPsLevel(int psLevel)
```

**Parameters**

- `psLevel` (`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.

### setReverse

```java
void com.datalogics.PDFL.PrintUserParams.setReverse(int reverse)
```

**Parameters**

- `reverse` (`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.

### setShrinkToFit

```java
void com.datalogics.PDFL.PrintUserParams.setShrinkToFit(boolean shrinkToFit)
```

**Parameters**

- `shrinkToFit` (`boolean`): 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.

### setStartPage

```java
void com.datalogics.PDFL.PrintUserParams.setStartPage(int startPage)
```

**Parameters**

- `startPage` (`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.

### setStartResult

```java
void com.datalogics.PDFL.PrintUserParams.setStartResult(int startResult)
```

**Parameters**

- `startResult` (`int`): the Spooler ID

**Returns:** `void`

Sets the Spooler ID for StartDoc. This API is available on Windows and Unix only.

### setTransQuality

```java
void com.datalogics.PDFL.PrintUserParams.setTransQuality(int transQuality)
```

**Parameters**

- `transQuality` (`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.

### setUseCustomPaperSize

```java
void com.datalogics.PDFL.PrintUserParams.setUseCustomPaperSize(boolean useCustomPaperSize)
```

**Parameters**

- `useCustomPaperSize` (`boolean`): pass true to use custom size.

**Returns:** `void`

Sets whether to force the use of the paper size provided in the PaperWidth and PaperHeight parameters and not search for best fit size provided by printer. SetPageSize must also be set.

### useDefaultPrinter

```java
void com.datalogics.PDFL.PrintUserParams.useDefaultPrinter(Document doc)
```

**Parameters**

- `doc` ([`Document`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Document.md)): a Document which will be used to set the maximum page range.

**Returns:** `void`

Set the print parameters to the defaults. The parameters set include the printer, page range, paper size, number of copies, and duplexing mode.

Operating system defaults for these parameters will be copied into the corresponding PrintUserParams fields. If you want to override the system defaults, change these fields after calling UseDefaultPrinter().
