public class PrintUserParams
extends java.lang.Object
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.
| Modifier and Type | Field and Description |
|---|---|
static int |
USE_CROP_BOX
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.
|
static int |
USE_MEDIA_BOX
When paper height and width are initialized to this value the printed product more closely resembles what comes out of most PDF Viewers.
|
| Constructor and Description |
|---|
PrintUserParams() |
| Modifier and Type | Method and Description |
|---|---|
void |
choosePaperSourceBySize(double width,
double height)
Choose the best paper source for a given width and height.
|
void |
delete() |
java.util.List<java.lang.String> |
enumeratePaperSources()
Enumerates available tray/bin names for the specified printer.
|
int |
getBinaryOK()
Gets whether to enable Binary data, 1 turns it on and 0 turns it off.
|
boolean |
getCollate()
Collate property.
|
java.lang.String |
getCommand()
Gets the Optional command line arguments on Unix.
|
java.lang.String |
getDeviceName()
The unicode name of the device to print to (for example, "Distiller Assistant
v3.01").
|
int |
getDoOPP()
Gets the OverPrint Preview setting, 1 uses it, 0 does not.
|
java.lang.String |
getDriverName()
The unicode name of the driver (for example, "winspool").
|
int |
getEmitHalftones()
Gets the Emit half-tones setting, 1 turns it on, 0 turns it off.
|
boolean |
getEmitToFile()
Gets whether a Postscript file is created.
|
boolean |
getEmitToPrinter()
Gets whether to Output the PDF document to a Postscript Printer.
|
int |
getEndPage()
Gets the page on which to finish printing, using zero-based nubmering.
|
FarEastFont |
getFarEastFontOpt()
Gets the Far East Font setting.
|
java.lang.String |
getInFileName()
Unicode name used for the Windows DOCINFO structure (lpszDocName) that points to a NULL-terminated string that specifying the name of the document.
|
int |
getNCopies()
Gets the number of copies to print.
|
java.lang.String |
getOutFileName()
Unicode name used for the Windows DOCINFO structure (lpszOutput).
|
int |
getPaperHeight()
Gets the Height of paper in points.
|
int |
getPaperSource()
Paper source property.
|
int |
getPaperWidth()
Gets the Width of paper in points.
|
java.lang.String |
getPortName()
The unicode name of the port (for example, "Ne00").
|
int |
getPrintAnnots()
Gets the printing annotations setting, 1 turns it on, 0 turns it off.
|
PrintParams |
getPrintParams()
Gets the Print Parameter settings.
|
int |
getPsLevel()
Gets the Postscript level.
|
int |
getReverse()
Gets whether to reverses print order, 1 reverses it and 0 does regular order.
|
boolean |
getShrinkToFit()
Gets the Shrink to fit setting, true turns it on, false turns it off.
|
int |
getStartPage()
Gets the page to start printing with, using zero-based numbering.
|
int |
getStartResult()
Gets the Spooler ID from StartDoc.
|
int |
getTransQuality()
Gets the Transparency flattening quality control.
|
boolean |
getUseCustomPaperSize()
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.
|
int |
paperSourceIdByName(java.lang.String trayName)
Obtain tray/bin number by its name.
|
boolean |
posePrintDialog(Document doc)
Set the print parameters by posing a dialog box to the user.
|
void |
setBinaryOK(int binaryOK)
Sets whether to enable Binary datam, 1 turns it on and 0 turns it off.
|
void |
setCollate(boolean collate)
Collate property.
|
void |
setCommand(java.lang.String command)
Sets the Optional command line arguments on Unix.
|
void |
setDeviceName(java.lang.String inStr) |
void |
setDoOPP(int doOPP)
Sets the OverPrint Preview setting, 1 uses it, 0 does not.
|
void |
setDriverName(java.lang.String inStr) |
void |
setEmitHalftones(int emitHalftones)
Sets the Emit half-tones setting, 1 turns it on, 0 turns it off.
|
void |
setEmitToFile(boolean emitToFile)
Sets whether a Postscript file is created.
|
void |
setEmitToPrinter(boolean emitToPrinter)
Sets whether to Output the PDF document to a Postscript Printer.
|
void |
setEndPage(int endPage)
Sets the page on which to finish printing, using zero-based nubmering.
|
void |
setFarEastFontOpt(FarEastFont farEastFontOpt)
Sets the Far East Font setting.
|
void |
setInFileName(java.lang.String inStr) |
void |
setNCopies(int nCopies)
Sets the number of copies to print.
|
void |
setOutFileName(java.lang.String inStr) |
void |
setPaperHeight(int paperHeight)
Sets the Height of paper in points.
|
void |
setPaperSource(int PaperSource)
Paper source property.
|
void |
setPaperWidth(int paperWidth)
Sets the Width of paper in points.
|
void |
setPortName(java.lang.String inStr) |
void |
setPrintAnnots(int printAnnots)
Sets the printing annotations setting, 1 turns it on, 0 turns it off.
|
void |
setPsLevel(int psLevel)
Sets the Postscript level.
|
void |
setReverse(int reverse)
Sets whether to reverses print order, 1 reverses it and 0 does regular order.
|
void |
setShrinkToFit(boolean shrinkToFit)
Sets the Shrink to fit setting, true turns it on, false turns it off.
|
void |
setStartPage(int startPage)
Sets the page to start printing with, using zero-based numbering.
|
void |
setStartResult(int startResult)
Sets the Spooler ID for StartDoc.
|
void |
setTransQuality(int transQuality)
Sets the Transparency flattening quality control.
|
void |
setUseCustomPaperSize(boolean useCustomPaperSize)
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.
|
void |
useDefaultPrinter(Document doc)
Set the print parameters to the defaults.
|
public static final int USE_MEDIA_BOX
public static final int USE_CROP_BOX
public void delete()
public boolean posePrintDialog(Document doc)
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().
doc - a Document which will be used to set the maximum page range in the dialog box.public void useDefaultPrinter(Document doc)
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().
doc - a Document which will be used to set the maximum page range.public PrintParams getPrintParams()
public void choosePaperSourceBySize(double width,
double 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.
width - the desired width of the output in user unitsheight - the desired height of the output in user unitspublic java.lang.String getInFileName()
public void setInFileName(java.lang.String inStr)
public java.lang.String getOutFileName()
public void setOutFileName(java.lang.String inStr)
public java.lang.String getDeviceName()
public void setDeviceName(java.lang.String inStr)
public java.lang.String getDriverName()
public void setDriverName(java.lang.String inStr)
public java.lang.String getPortName()
public void setPortName(java.lang.String inStr)
public boolean getEmitToFile()
public void setEmitToFile(boolean emitToFile)
emitToFile - pass true to emit output to a PostScript filepublic boolean getEmitToPrinter()
public void setEmitToPrinter(boolean emitToPrinter)
emitToPrinter - pass true to emit to the printerpublic int getPaperWidth()
public void setPaperWidth(int paperWidth)
paperWidth - the width of the paper in pointspublic int getPaperHeight()
public void setPaperHeight(int paperHeight)
paperHeight - the height of the paper in pointspublic java.lang.String getCommand()
public void setCommand(java.lang.String command)
command - the optional command line argumentspublic int getStartResult()
public void setStartResult(int startResult)
startResult - the Spooler IDpublic int getNCopies()
public void setNCopies(int nCopies)
nCopies - the number of copies to print.public int getStartPage()
public void setStartPage(int startPage)
startPage - the page to start onpublic int getEndPage()
public void setEndPage(int endPage)
endPage - the page to end uponpublic boolean getShrinkToFit()
public void setShrinkToFit(boolean shrinkToFit)
shrinkToFit - pass true to shrink the page to fitpublic int getPrintAnnots()
public void setPrintAnnots(int printAnnots)
printAnnots - 1 to print annotations, 0 to not print them.public int getPsLevel()
public void setPsLevel(int psLevel)
psLevel - Postscript Level setting.public int getBinaryOK()
public void setBinaryOK(int binaryOK)
binaryOK - Binary Ok setting.public int getEmitHalftones()
public void setEmitHalftones(int emitHalftones)
emitHalftones - 1 if halftones will be emitted, 0 if notpublic int getReverse()
public void setReverse(int reverse)
reverse - 1 to reverse page order or 0 for regular orderpublic int getDoOPP()
public void setDoOPP(int doOPP)
doOPP - 1 if OverPrint Preview will be used, 0 if notpublic FarEastFont getFarEastFontOpt()
public void setFarEastFontOpt(FarEastFont farEastFontOpt)
farEastFontOpt - a PDFarEastFont value that represents the setting to be usedpublic int getTransQuality()
public void setTransQuality(int transQuality)
transQuality - the transparency flatting quality, 1 is fastest; 5 is bestpublic void setCollate(boolean collate)
collate - True if need to collate copies.public boolean getCollate()
public void setPaperSource(int PaperSource)
PaperSource - paper source which must be selected.public int getPaperSource()
public void setUseCustomPaperSize(boolean useCustomPaperSize)
useCustomPaperSize - pass true to use custom size.public boolean getUseCustomPaperSize()
public java.util.List<java.lang.String> enumeratePaperSources()
public int paperSourceIdByName(java.lang.String trayName)
trayName - the tray/bin's name whose number need to obtain.