Class PrintJob
- All Implemented Interfaces:
Proxy
You only need to deal directly with print jobs if you use the
non-portable PrintUnixDialog API.
Use getSurface() to obtain the cairo surface
onto which the pages must be drawn. Use send(org.gnome.gtk.PrintJobCompleteFunc)
to send the finished job to the printer. If you don’t use cairo
GtkPrintJob also supports printing of manually generated PostScript,
via setSourceFile(java.lang.String).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classPrintJob.Builder<B extends PrintJob.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static interfaceFunctional interface declaration of theStatusChangedCallbackcallback.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionPrintJob()Creates a new PrintJob.PrintJob(MemorySegment address) Create a PrintJob proxy instance for the provided memory address.PrintJob(String title, Printer printer, PrintSettings settings, PageSetup pageSetup) Creates a newGtkPrintJob. -
Method Summary
Modifier and TypeMethodDescriptionprotected PrintJobasParent()Returns this instance as if it were its parent type.static PrintJob.Builder<? extends PrintJob.Builder> builder()APrintJob.Builderobject constructs aPrintJobwith the specified properties.voidEmits the "status-changed" signal.booleanGets whether this job is printed collated.intGets the number of copies of this job.intgetNUp()Gets the n-up setting for this job.Gets the n-up layout setting for this job.Gets the page ranges for this job.getPages()Gets theGtkPrintPagessetting for this job.Gets theGtkPageSetsetting for this job.Gets theGtkPrinterof the print job.booleanGets whether this job is printed reversed.booleanGets whether the job is printed rotated.doublegetScale()Gets the scale for this job.Gets theGtkPrintSettingsof the print job.Gets the status of the print job.org.freedesktop.cairo.SurfaceGets a cairo surface onto which the pages of the print job should be rendered.getTitle()Gets the job title.booleanReturns whether jobs will be tracked after printing.static @Nullable TypegetType()Get the GType of the PrintJob classEmitted when the status of a job changes.voidsend(@Nullable PrintJobCompleteFunc callback) Sends the print job off to the printer.voidsetCollate(boolean collate) Sets whether this job is printed collated.voidsetNumCopies(int numCopies) Sets the number of copies for this job.voidsetNUp(int nUp) Sets the n-up setting for this job.voidsetNUpLayout(NumberUpLayout layout) Sets the n-up layout setting for this job.voidsetPageRanges(@Nullable PageRange @Nullable [] ranges) Sets the page ranges for this job.voidsetPages(PrintPages pages) Sets theGtkPrintPagessetting for this job.voidsetPageSet(PageSet pageSet) Sets theGtkPageSetsetting for this job.voidsetReverse(boolean reverse) Sets whether this job is printed reversed.voidsetRotate(boolean rotate) Sets whether this job is printed rotated.voidsetScale(double scale) Sets the scale for this job.booleansetSourceFd(int fd) Make theGtkPrintJobsend an existing document to the printing system.booleansetSourceFile(String filename) Make theGtkPrintJobsend an existing document to the printing system.voidsetTrackPrintStatus(boolean trackStatus) If track_status istrue, the print job will try to continue report on the status of the print job in the printer queues and printer.Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getMemoryLayout, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
PrintJob
Create a PrintJob proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
PrintJob
Creates a newGtkPrintJob.- Parameters:
title- the job titleprinter- aGtkPrintersettings- aGtkPrintSettingspageSetup- aGtkPageSetup
-
PrintJob
public PrintJob()Creates a new PrintJob.
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuperkeyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName(). This will call the native function pointer of this virtual method in the typeclass of the parent type. -
getCollate
public boolean getCollate()Gets whether this job is printed collated.- Returns:
- whether the job is printed collated
-
getNUp
public int getNUp()Gets the n-up setting for this job.- Returns:
- the n-up setting
-
getNUpLayout
Gets the n-up layout setting for this job.- Returns:
- the n-up layout
-
getNumCopies
public int getNumCopies()Gets the number of copies of this job.- Returns:
- the number of copies
-
getPageRanges
Gets the page ranges for this job.- Returns:
- a pointer to an
array of
GtkPageRangestructs
-
getPageSet
Gets theGtkPageSetsetting for this job.- Returns:
- the
GtkPageSetsetting
-
getPages
Gets theGtkPrintPagessetting for this job.- Returns:
- the
GtkPrintPagessetting
-
getPrinter
Gets theGtkPrinterof the print job.- Returns:
- the printer of this PrintJob
-
getReverse
public boolean getReverse()Gets whether this job is printed reversed.- Returns:
- whether the job is printed reversed.
-
getRotate
public boolean getRotate()Gets whether the job is printed rotated.- Returns:
- whether the job is printed rotated
-
getScale
public double getScale()Gets the scale for this job.- Returns:
- the scale
-
getSettings
Gets theGtkPrintSettingsof the print job.- Returns:
- the settings of this PrintJob
-
getStatus
Gets the status of the print job.- Returns:
- the status of this PrintJob
-
getSurface
Gets a cairo surface onto which the pages of the print job should be rendered.- Returns:
- the cairo surface of this PrintJob
- Throws:
GErrorException- seeGError
-
getTitle
-
getTrackPrintStatus
public boolean getTrackPrintStatus()Returns whether jobs will be tracked after printing.For details, see
setTrackPrintStatus(boolean).- Returns:
trueif print job status will be reported after printing
-
send
Sends the print job off to the printer.- Parameters:
callback- function to call when the job completes or an error occurs
-
setCollate
public void setCollate(boolean collate) Sets whether this job is printed collated.- Parameters:
collate- whether the job is printed collated
-
setNUp
public void setNUp(int nUp) Sets the n-up setting for this job.- Parameters:
nUp- the n-up value
-
setNUpLayout
Sets the n-up layout setting for this job.- Parameters:
layout- the n-up layout setting
-
setNumCopies
public void setNumCopies(int numCopies) Sets the number of copies for this job.- Parameters:
numCopies- the number of copies
-
setPageRanges
Sets the page ranges for this job.- Parameters:
ranges- pointer to an array ofGtkPageRangestructs
-
setPageSet
Sets theGtkPageSetsetting for this job.- Parameters:
pageSet- aGtkPageSetsetting
-
setPages
Sets theGtkPrintPagessetting for this job.- Parameters:
pages- theGtkPrintPagessetting
-
setReverse
public void setReverse(boolean reverse) Sets whether this job is printed reversed.- Parameters:
reverse- whether the job is printed reversed
-
setRotate
public void setRotate(boolean rotate) Sets whether this job is printed rotated.- Parameters:
rotate- whether to print rotated
-
setScale
public void setScale(double scale) Sets the scale for this job.1.0 means unscaled.
- Parameters:
scale- the scale
-
setSourceFd
Make theGtkPrintJobsend an existing document to the printing system.The file can be in any format understood by the platforms printing system (typically PostScript, but on many platforms PDF may work too). See
Printer.acceptsPdf()andPrinter.acceptsPs().This is similar to
setSourceFile(java.lang.String), but takes expects an open file descriptor for the file, instead of a filename.- Parameters:
fd- a file descriptor- Returns:
falseif an error occurred- Throws:
GErrorException- seeGError
-
setSourceFile
Make theGtkPrintJobsend an existing document to the printing system.The file can be in any format understood by the platforms printing system (typically PostScript, but on many platforms PDF may work too). See
Printer.acceptsPdf()andPrinter.acceptsPs().- Parameters:
filename- the file to be printed- Returns:
falseif an error occurred- Throws:
GErrorException- seeGError
-
setTrackPrintStatus
public void setTrackPrintStatus(boolean trackStatus) If track_status istrue, the print job will try to continue report on the status of the print job in the printer queues and printer.This can allow your application to show things like “out of paper” issues, and when the print job actually reaches the printer.
This function is often implemented using some form of polling, so it should not be enabled unless needed.
- Parameters:
trackStatus-trueto track status after printing
-
onStatusChanged
public SignalConnection<PrintJob.StatusChangedCallback> onStatusChanged(PrintJob.StatusChangedCallback handler) Emitted when the status of a job changes.The signal handler can use
getStatus()to obtain the new status.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitStatusChanged
public void emitStatusChanged()Emits the "status-changed" signal. SeeonStatusChanged(org.gnome.gtk.PrintJob.StatusChangedCallback). -
builder
APrintJob.Builderobject constructs aPrintJobwith the specified properties. Use the variousset...()methods to set properties, and finish construction withPrintJob.Builder.build().- Returns:
- the builder object
-