Class PrintJob
- All Implemented Interfaces:
Proxy
GtkPrintJob
object represents a job that is sent to a printer.
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
Modifier and TypeClassDescriptionstatic class
PrintJob.Builder<B extends PrintJob.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static interface
Functional interface declaration of theStatusChangedCallback
callback.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionPrintJob
(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 PrintJob
asParent()
Returns this instance as if it were its parent type.static PrintJob.Builder
<? extends PrintJob.Builder> builder()
APrintJob.Builder
object constructs aPrintJob
with the specified properties.void
Emits the "status-changed" signal.boolean
Gets whether this job is printed collated.int
Gets the number of copies of this job.int
getNUp()
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 theGtkPrintPages
setting for this job.Gets theGtkPageSet
setting for this job.Gets theGtkPrinter
of the print job.boolean
Gets whether this job is printed reversed.boolean
Gets whether the job is printed rotated.double
getScale()
Gets the scale for this job.Gets theGtkPrintSettings
of the print job.Gets the status of the print job.org.freedesktop.cairo.Surface
Gets a cairo surface onto which the pages of the print job should be rendered.getTitle()
Gets the job title.boolean
Returns whether jobs will be tracked after printing.static Type
getType()
Get the GType of the PrintJob classEmitted when the status of a job changes.void
send
(PrintJobCompleteFunc callback) Sends the print job off to the printer.void
setCollate
(boolean collate) Sets whether this job is printed collated.void
setNumCopies
(int numCopies) Sets the number of copies for this job.void
setNUp
(int nUp) Sets the n-up setting for this job.void
setNUpLayout
(NumberUpLayout layout) Sets the n-up layout setting for this job.void
setPageRanges
(PageRange[] ranges) Sets the page ranges for this job.void
setPages
(PrintPages pages) Sets theGtkPrintPages
setting for this job.void
setPageSet
(PageSet pageSet) Sets theGtkPageSet
setting for this job.void
setReverse
(boolean reverse) Sets whether this job is printed reversed.void
setRotate
(boolean rotate) Sets whether this job is printed rotated.void
setScale
(double scale) Sets the scale for this job.boolean
setSourceFd
(int fd) Make theGtkPrintJob
send an existing document to the printing system.boolean
setSourceFile
(String filename) Make theGtkPrintJob
send an existing document to the printing system.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.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, 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, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.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
public PrintJob(String title, Printer printer, PrintSettings settings, PageSetup pageSetup) throws UnsupportedPlatformException Creates a newGtkPrintJob
.- Parameters:
title
- the job titleprinter
- aGtkPrinter
settings
- aGtkPrintSettings
pageSetup
- aGtkPageSetup
- Throws:
UnsupportedPlatformException
- when run on a platform other than linux or macos
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuper
keyword, 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
GtkPageRange
structs
-
getPageSet
Gets theGtkPageSet
setting for this job.- Returns:
- the
GtkPageSet
setting
-
getPages
Gets theGtkPrintPages
setting for this job.- Returns:
- the
GtkPrintPages
setting
-
getPrinter
Gets theGtkPrinter
of 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 theGtkPrintSettings
of 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:
true
if 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 ofGtkPageRange
structs
-
setPageSet
Sets theGtkPageSet
setting for this job.- Parameters:
pageSet
- aGtkPageSet
setting
-
setPages
Sets theGtkPrintPages
setting for this job.- Parameters:
pages
- theGtkPrintPages
setting
-
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 theGtkPrintJob
send 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:
false
if an error occurred- Throws:
GErrorException
- seeGError
-
setSourceFile
Make theGtkPrintJob
send 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:
false
if 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
-true
to 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.Builder
object constructs aPrintJob
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withPrintJob.Builder.build()
.
-