Summary:
This adds another 'FilePrinter::printFile' method that
accepts an additional parameter to specify whether or not to
do scaling and passes the 'fit-to-page' to CUPS dependent
on what is specified.
If FilePrinter is used, The PDF generator now passes this
option depending on the scaling mode that was selected in the
custom print options widget, which is therefore now enabled
for non-rasterized printing as well.
Test Plan:
1) open a PDF document in Okular and open the print dialog
2) go to the "PDF Options" tab
3) verify that "Force rasterisation" is disabled, but the
"Scale mode" combobox is active.
4) test all the three options available in the "Scale mode"
combobox do what they say
5) Make sure the three options still work as expected for
the "Force rasterisation" case.
Reviewers: #okular, ngraham, sander
Reviewed By: ngraham
Subscribers: aacid, fvogt, okular-devel
Tags: #okular
Differential Revision: https://phabricator.kde.org/D18179
Summary:
This adds a combobox in the print dialog of the non-PDF
generators to allow selecting whether or not to take
print margins into account.
For the PDF case and rasterized printing, new print otions have
been implemented in commit 2e97d58750
already, which adds an additional option to do no scaling at all.
For consistency reasons, the same terms also used for the PDF
case are used in the combobox (i.e. the two of the three that
apply).
This adds a new abstract class 'PrintOptionsWidget' with a
'ignorePrintMargins()' method to indicate whether print margins
should be ignored or not, and a default implementation.
The existing widget for the PDF generator now derives from this
class.
In order to avoid an ABI breakage, the return value of
'Document::printConfigurationWidget' is left as a 'QWidget *'
and a dynamic_cast is done on use.
FilePrinter is adapted to take into account the value set by
'QPrinter::setFullPage()' and the margin options
are now passed accordingly (either the values set in the dialog or '0').
A big thanks to Albert Astals Cid <aacid@kde.org> for showing how
to extend the initial implementation to cover more generators.
Test Plan:
1) Open a PostScript file in Okular (using a document size that matches
a paper size available on the printer used later makes it easier
to see things behave as expected)
2) open print dialog, go to "Print options" and notice that there is a new
"Scale mode" combobox whose value is set to "Fit to printable area"
by default.
3) don't change any options, print to a printer that has hardware margins
Expected result: the document is scaled to the printable area (e.g.
scaled down so that the printer's hardware margins remain empty) as it
has been without this change.
4) Set the value of the "Print Options" -> "Scale mode" combobox to
"Fit to full page" and print again
Expected result: The document is scaled to the full page size, i.e. ignoring
the printer's hardware margins.
5) Try steps 1-4 with other document formats supported by Okular and
observe that they behave the same (except for the PDF case, where
there's a combobox with three options that has been implemented
independent of this change).
Reviewers: #okular, ngraham
Reviewed By: ngraham
Subscribers: fvogt, rkflx, arthurpeters, ltoscano, okular-devel, aacid, ngraham
Tags: #okular
Differential Revision: https://phabricator.kde.org/D10974
The method FilePrinter::psPaperSize used to contain a long
list of hard-coded paper sizes for the different paper formats.
This patch makes the method get the same information
from QPrinter directly, which is much simpler and more
robust, too.
Note that the method is not actually used anywhere in okular,
though, so this change is purely cosmetic.
REVIEW: 130043
Okular was checking for Q_WS_X11 definition (which is not available since Qt 5) to detect CUPS, so detection always fails making CUPS parameters ignored.
REVIEW: 127036
This makes automagically work the printing on printers with
hard-margins since the QPrinter dialog margins are initialized to the printer
hard-margins. If you still want the old and mostly unuseful
behaviour of not having any margin (and thus your printer not printing things on the borders) you
can always set the margins to 0 in the dialog
BUGS: 319476
FIXED-IN: 4.12.0
API and make it call the new API.
CCMAIL: kde-bindings@kde.org
CCMAIL: aacid@kde.org
CCBUG: 194586
svn path=/trunk/KDE/kdegraphics/okular/; revision=1134631
into pdf format and save that. Only enabled in PDF, DVI, and DJVU generators
if ps2pdf is found in the path. Ghostscript is almost always guaranteed to
be installed given many parts of the printing stack depends on it.
Note that resulting PDF or PS file will have the page size as set in the print
dialog and not the page size of the original document, i.e. if an A5 booklet
is printed but the dialog page size is set to A4 then the resulting file will
be A4 and not A5.
svn path=/trunk/KDE/kdegraphics/okular/; revision=897000
1) detectCupsService() finally works because QTCPSocket finally works.
Assumes Cups is on localhost:631 which is a compromise as Qt won't
even tell us if it is using Cups, let alone where Cups is.
2) Duplex printing obeys user selected option from dialog rather than
just guessing.
3) If custom page margins set then respect these
svn path=/trunk/KDE/kdegraphics/okular/; revision=895905
Cups Page and Job Options tabs, and pass these on to lpr.
CCBUG: 160381
This needs to be backported to 4.0 but I don't have a checkout.
svn path=/trunk/KDE/kdegraphics/okular/; revision=817393
When detecting which exe to use, check for these first.
CCBUG: 156639
This should be backported to 4.0, but I don't have a checkout of that.
svn path=/trunk/KDE/kdegraphics/okular/; revision=816881