<table><tr><td style="">michaelweghorn updated this revision to Diff 49223.<br />michaelweghorn retitled this revision from "Add option to ignore print margins" to "Add option to ignore print margins for non-PDF generators".<br />michaelweghorn edited the summary of this revision. <a href="https://phabricator.kde.org/transactions/detail/PHID-XACT-DREV-ye3ltoupuwtkzqd/">(Show Details)</a><br />michaelweghorn edited the test plan for this revision. <a href="https://phabricator.kde.org/transactions/detail/PHID-XACT-DREV-56va7wzl2xolxkd/">(Show Details)</a><br />michaelweghorn added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D10974">View Revision</a></tr></table><br /><div><div><p>Changes in this version:</p>

<ul class="remarkup-list">
<li class="remarkup-list-item">rebase to current master, including Oliver's printing changes for PDF</li>
<li class="remarkup-list-item">adapt GUI elements to match those used for the PDF case (only "Fit to printable area" and "Fit to full page" though)</li>
<li class="remarkup-list-item">only cover non-PDF generators in this change (PDF case will be dealt with in a subsequent change)</li>
</ul></div></div><br /><div><strong>CHANGES TO REVISION SUMMARY</strong><div><div style="white-space: pre-wrap; color: #74777D;">This adds a c<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">heckbox</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">ombobox</span> in the print dialog <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">to make it possible to</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">of the non-PDF<br />
generators to allow selecting whether or not to take<br />
print margins into account.<br />
<br />
For the PDF case and rasterized printing, new print otions have<br />
been implemented in commit 2e97d587508dff08aaf86ff149c8ed6b7658950d<br />
already, which adds an additional option to do no scaling at all.<br />
<br />
For consistency reasons, the same terms also used for the PDF<br />
case are used in the combobox (i.e. the two of the three that</span><br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">select whether or not to take print margins into account when printing</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">apply)</span>.<br />
<br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">QPrinter::setFullPage() is used which makes the print margins</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">This adds a new abstract class 'PrintOptionsWidget' with a<br />
'ignorePrintMargins()' method to indicate whether print margins<br />
should be ignored or not, and a default implementation.</span><br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">to be ignored "automatically" in case of the QPrinter based approach</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">The existing widget for the PDF generator now derives from this</span><br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">(e.g. "Force rasterization" option enabled).</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">class.<br />
<br />
FilePrinter is adapted to take into account the value set by</span><br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">For the case where FilePrinter is used,</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">'QPrinter::setFullPage()' and</span> the margin options<br />
are <span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">now </span>passed accordingly (either the values set in the dialog or '0').<br />
<br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">BUG: 336617</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">A big thanks to Albert Astals Cid <aacid@kde.org> for showing how<br />
to extend the initial implementation to cover more generators.</span></div></div></div><br /><div><strong>CHANGES TO TEST PLAN</strong><div><div style="white-space: pre-wrap; color: #74777D;">1) Open a P<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">DF</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">ostScript</span> file in Okular (using a document size that matches<div style="padding: 8px 0;">...</div>2) open print dialog, go to "P<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">DF</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">rint</span> options" and notice that there is a new<br />
  <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">"Ignore print margins" checkbox that is disabled</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">"Scale mode" combobox whose value is set to "Fit to printable area"<br />
  </span> by default.<div style="padding: 8px 0;">...</div>4) <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">Enable the "PDF options" -> "Ignore print margins" checkbox and print again<br />
<br />
Expected result: The document is scaled to the full page size, i.e. ignoring<br />
the printer's hardware margins.</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">Set the value of the "Print Options" -> "Scale mode" combobox to<br />
   "Fit to full page" and print again</span><br />
<br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">5) Take steps 3 and 4 again,</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">Expected result: The document is scaled to the full page size, i.e.</span> <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">but now enabling the "Force rasterize"</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">ignoring</span><br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">  option in addition</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">the printer's hardware margins.</span><br />
<br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">Expected result: The printout behaves the same way as in steps 3 and 4 without</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">5) Try steps 1-4 with other document formats supported by Okular and</span><br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">the "Force rasterize" option being set.<br />
<br />
6) Try steps 1-4 with other documen</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">   observe that they behave the same (excep</span>t for<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">mats supported by Okular and</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);"> the PDF case, where</span><br />
   <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">observe that they behave the same (except</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">there's a combobox with three options</span> that <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">the option is now in a</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">has been implemented</span><br />
   <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">tab called "Print Options" rather than "PDF Options"</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">independent of this change</span>).</div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R223 Okular</div></div></div><br /><div><strong>CHANGES SINCE LAST UPDATE</strong><div><a href="https://phabricator.kde.org/D10974?vs=34821&id=49223">https://phabricator.kde.org/D10974?vs=34821&id=49223</a></div></div><br /><div><strong>BRANCH</strong><div><div>michaelweghorn/WIP_add_scaling_options_for_other_generators</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D10974">https://phabricator.kde.org/D10974</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>CMakeLists.txt<br />
core/document.cpp<br />
core/document.h<br />
core/fileprinter.cpp<br />
core/printoptionswidget.cpp<br />
core/printoptionswidget.h<br />
generators/poppler/generator_pdf.cpp<br />
generators/poppler/generator_pdf.h<br />
interfaces/printinterface.h<br />
part.cpp</div></div></div><br /><div><strong>To: </strong>michaelweghorn, Okular<br /><strong>Cc: </strong>fvogt, rkflx, arthurpeters, ltoscano, okular-devel, aacid, ngraham, darcyshen<br /></div>