Package ch.bailu.gtk.gtk
Class PrintJob
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.gobject.Object
ch.bailu.gtk.gtk.PrintJob
- All Implemented Interfaces:
PointerInterface
A `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 [class@Gtk.PrintUnixDialog] API.
Use [method@Gtk.PrintJob.get_surface] to obtain the cairo surface
onto which the pages must be drawn. Use [method@Gtk.PrintJob.send]
to send the finished job to the printer. If you don’t use cairo
`GtkPrintJob` also supports printing of manually generated PostScript,
via [method@Gtk.PrintJob.set_source_file].
You only need to deal directly with print jobs if you use the
non-portable [class@Gtk.PrintUnixDialog] API.
Use [method@Gtk.PrintJob.get_surface] to obtain the cairo surface
onto which the pages must be drawn. Use [method@Gtk.PrintJob.send]
to send the finished job to the printer. If you don’t use cairo
`GtkPrintJob` also supports printing of manually generated PostScript,
via [method@Gtk.PrintJob.set_source_file].
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static interface
static interface
Nested classes/interfaces inherited from class ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Field Summary
Fields inherited from class ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Constructor Summary
ConstructorDescriptionPrintJob
(PointerContainer pointer) PrintJob
(Str title, Printer printer, PrintSettings settings, PageSetup page_setup) Creates a new `GtkPrintJob`.PrintJob
(String title, Printer printer, PrintSettings settings, PageSetup page_setup) Creates a new `GtkPrintJob`. -
Method Summary
Modifier and TypeMethodDescriptionstatic ClassHandler
boolean
Gets whether this job is printed collated.static int
int
Gets the number of copies of this job.int
getNUp()
Gets the n-up setting for this job.int
Gets the n-up layout setting for this job.int
getPages()
Gets the `GtkPrintPages` setting for this job.int
Gets the `GtkPageSet` setting for this job.static long
static TypeSystem.TypeSize
Gets the `GtkPrinter` 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 the `GtkPrintSettings` of the print job.int
Gets the status of the print job.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 long
static TypeSystem.TypeSize
Connect to signal "status-changed".void
send
(PrintJob.OnPrintJobCompleteFunc callback, Pointer user_data, PrintJob.OnDestroyNotify dnotify) Sends the print job off to the printer.void
setCollate
(boolean collate) Sets whether this job is printed collated.void
setNumCopies
(int num_copies) Sets the number of copies for this job.void
setNUp
(int n_up) Sets the n-up setting for this job.void
setNUpLayout
(int layout) Sets the n-up layout setting for this job.void
setPages
(int pages) Sets the `GtkPrintPages` setting for this job.void
setPageSet
(int page_set) Sets the `GtkPageSet` 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 the `GtkPrintJob` send an existing document to the
printing system.boolean
setSourceFile
(Str filename) Make the `GtkPrintJob` send an existing document to the
printing system.boolean
setSourceFile
(String filename) Make the `GtkPrintJob` send an existing document to the
printing system.void
setTrackPrintStatus
(boolean track_status) If track_status is %TRUE, 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 ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Methods inherited from class ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Methods inherited from class ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Field Details
-
SIGNAL_ON_STATUS_CHANGED
- See Also:
-
-
Constructor Details
-
PrintJob
-
PrintJob
public PrintJob(@Nonnull Str title, @Nonnull Printer printer, @Nonnull PrintSettings settings, @Nonnull PageSetup page_setup) Creates a new `GtkPrintJob`.- Parameters:
title
- the job titleprinter
- a `GtkPrinter`settings
- a `GtkPrintSettings`page_setup
- a `GtkPageSetup`
-
PrintJob
public PrintJob(String title, @Nonnull Printer printer, @Nonnull PrintSettings settings, @Nonnull PageSetup page_setup) Creates a new `GtkPrintJob`.- Parameters:
title
- the job titleprinter
- a `GtkPrinter`settings
- a `GtkPrintSettings`page_setup
- a `GtkPageSetup`
-
-
Method Details
-
getClassHandler
-
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
public int 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
-
getPageSet
public int getPageSet()Gets the `GtkPageSet` setting for this job.- Returns:
- the `GtkPageSet` setting
-
getPages
public int getPages()Gets the `GtkPrintPages` setting for this job.- Returns:
- the `GtkPrintPages` setting
-
getPrinter
Gets the `GtkPrinter` of the print job.- Returns:
- the printer of @job
-
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 the `GtkPrintSettings` of the print job.- Returns:
- the settings of @job
-
getStatus
public int getStatus()Gets the status of the print job.- Returns:
- the status of @job
-
getSurface
Gets a cairo surface onto which the pages of
the print job should be rendered.- Returns:
- the cairo surface of @job
- Throws:
AllocationError
-
getTitle
Gets the job title.- Returns:
- the title of @job
-
getTrackPrintStatus
public boolean getTrackPrintStatus()Returns whether jobs will be tracked after printing.
For details, see [method@Gtk.PrintJob.set_track_print_status].- Returns:
- %TRUE if print job status will be reported after printing
-
send
public void send(PrintJob.OnPrintJobCompleteFunc callback, @Nullable Pointer user_data, PrintJob.OnDestroyNotify dnotify) Sends the print job off to the printer.- Parameters:
callback
- function to call when the job completes or an error occursuser_data
- user data that gets passed to @callbackdnotify
- destroy notify for @user_data
-
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 n_up) Sets the n-up setting for this job.- Parameters:
n_up
- the n-up value
-
setNUpLayout
public void setNUpLayout(int layout) Sets the n-up layout setting for this job.- Parameters:
layout
- the n-up layout setting
-
setNumCopies
public void setNumCopies(int num_copies) Sets the number of copies for this job.- Parameters:
num_copies
- the number of copies
-
setPageSet
public void setPageSet(int page_set) Sets the `GtkPageSet` setting for this job.- Parameters:
page_set
- a `GtkPageSet` setting
-
setPages
public void setPages(int pages) Sets the `GtkPrintPages` setting for this job.- Parameters:
pages
- the `GtkPrintPages` 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 the `GtkPrintJob` 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 [method@Gtk.Printer.accepts_pdf] and
[method@Gtk.Printer.accepts_ps].
This is similar to [method@Gtk.PrintJob.set_source_file],
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:
AllocationError
-
setSourceFile
Make the `GtkPrintJob` 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 [method@Gtk.Printer.accepts_pdf] and
[method@Gtk.Printer.accepts_ps].- Parameters:
filename
- the file to be printed- Returns:
- %FALSE if an error occurred
- Throws:
AllocationError
-
setSourceFile
Make the `GtkPrintJob` 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 [method@Gtk.Printer.accepts_pdf] and
[method@Gtk.Printer.accepts_ps].- Parameters:
filename
- the file to be printed- Returns:
- %FALSE if an error occurred
- Throws:
AllocationError
-
setTrackPrintStatus
public void setTrackPrintStatus(boolean track_status) If track_status is %TRUE, 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:
track_status
- %TRUE to track status after printing
-
onStatusChanged
Connect to signal "status-changed".
SeePrintJob.OnStatusChanged.onStatusChanged()
for signal description.
FieldSIGNAL_ON_STATUS_CHANGED
contains original signal name and can be used as resource reference.- Parameters:
signal
- callback function (lambda).- Returns:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-