<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>149560</bug_id>
          
          <creation_ts>2007-09-05 11:25:43 +0000</creation_ts>
          <short_desc>In kpdf when printing pdf, the margins are interchanged. left and right are mixed up, as are top and bottom</short_desc>
          <delta_ts>2007-09-05 20:19:24 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>10</classification_id>
          <classification>Unmaintained</classification>
          <product>kpdf</product>
          <component>general</component>
          <version>unspecified</version>
          <rep_platform>Gentoo Packages</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>dirkwallenstein</reporter>
          <assigned_to name="Albert Astals Cid">aacid</assigned_to>
          
          
          <cf_commitlink></cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>544557</commentid>
    <comment_count>0</comment_count>
    <who name="">dirkwallenstein</who>
    <bug_when>2007-09-05 11:25:43 +0000</bug_when>
    <thetext>Version:            (using KDE KDE 3.5.7)
Installed from:    Gentoo Packages
Compiler:          gcc-4.1.2 
OS:                Linux

How to reproduce:
- open kpdf and its print-dialog
- In properties-&gt;margins adapt only one margin left or right, top or bottom to huge values
- Print 
- In the up-popping dialog, choose “print with specified margins“. Actually the choice doesn&apos;t matter.

This does _not_ happen for example when printing html from within konqueror, which has the same general printing dialog.
Printing pdf from kpdf within konqueror has the same effect - interchanged margins.
The preview within the margins-dialog shows the expected behaviour - the left margin is on the left hand side, etc. 

I use centimeters (huger values), but that has no impact (as expected).
Other things: cups-1.2.12(currently), HP DeskJet 840C Foomatic/hpijs, 
Actually I retreated from filing a bug-report regarding this topic some time ago (a year or so, using lfs), to look for a configuration problem more thoroughly. Well, i didn&apos;t find one.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>544587</commentid>
    <comment_count>1</comment_count>
    <who name="Kurt Pfeifle">pfeifle</who>
    <bug_when>2007-09-05 14:32:42 +0000</bug_when>
    <thetext>changed $summary to take kdeprint out of the line of fire  :-)

Confirming this bug. I&apos;ll attach a test document which allows to better track down  the problem (it&apos;s just a few nested frames centered on an A4 page).

You can see how this bug exhibits itself also if you enble &quot;Preview&quot; in the kprinter main dialog (checkbox underneath the &quot;Properties&quot; button). 

Normally this test PDF I&apos;ll attach should be printed with zero margins (it&apos;s a full bleed page covering all available area). Set margins *really* to zero in kprinter, and the preview is as intended...

Now try to set different margins and see what the preview shows in each case (I used &quot;gv&quot; as the PostScript viewer, enabled in &quot;kaddprinterwizard --kdeconfig&quot; --&gt; Preview). The left-right margin swapping does not only occur with &apos;huge&apos; margins as the report seems to suggest; it already is present in the most minimal margin.

One additional bug, which is not explained by &quot;left and right margins are swapped&quot; is shown when you set all margins to zero, but use a bottom margin of, say 4 cm, and select &quot;Print with specified margins&quot;. You&apos;ll notice that the image also shifts to the top, and the top area even is cropped from the page...


BTW, besides the fact that the &quot;Print Aspect Ratio&quot; dialog does not do what it intends to, its contents are also not easy to understand...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>544588</commentid>
    <comment_count>2</comment_count>
      <attachid>21549</attachid>
    <who name="Kurt Pfeifle">pfeifle</who>
    <bug_when>2007-09-05 14:35:00 +0000</bug_when>
    <thetext>Created attachment 21549
Test document to demo this bug: use with kpdf; set margins; print with &quot;Preview&quot; enabled

This is the promised test document from my comment #2</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>544594</commentid>
    <comment_count>3</comment_count>
    <who name="Kurt Pfeifle">pfeifle</who>
    <bug_when>2007-09-05 15:00:30 +0000</bug_when>
    <thetext>&quot;Print with specified margins&quot; behaves like this in a few specific examples:

* if only left and right margins are set (and top/bottom both set to &quot;0&quot;), then
  left and right are swapped, the page image is *scaled* to fit into remaining 
  space  and the image is shifted to the bottom edge (zero margin bottom, 
  $whateverremains margin top)

* if only top and bottom margins are set (and left/right both set to &quot;0&quot;), then
  the image is *NOT* scaled at all, and image is shifted upward by the amount
  set by bottom margin (the top margin setting is completely ignored). Try it
  with both top and bottom margins set to 9cm, and left/right to 0cm....

* if you repeat that, and then add a left margin of, say 4cm, you see the page
  image gets scaled to fit into the available width, but it is still shifted
  upward by 9cm....</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>544648</commentid>
    <comment_count>4</comment_count>
    <who name="Albert Astals Cid">aacid</who>
    <bug_when>2007-09-05 20:19:24 +0000</bug_when>
    <thetext>SVN commit 708815 by aacid:

Sesame Street Class #1: Left is left, Right is right
Sesame Street Class #2: If you want to print parameters 0 and 1, use 0 and 1, not 0 and 0

This fixes some printing problems with margins

BUGS: 149560


 M  +1 -1      core/generator_pdf/generator_pdf.cpp  
 M  +1 -1      xpdf/xpdf/PSOutputDev.cc  


--- branches/KDE/3.5/kdegraphics/kpdf/core/generator_pdf/generator_pdf.cpp #708814:708815
@@ -466,7 +466,7 @@
     {
       pstitlechar = 0;
     }
-    PSOutputDev *psOut = new PSOutputDev(const_cast&lt;char*&gt;(tf.name().latin1()), const_cast&lt;char*&gt;(pstitlechar), pdfdoc-&gt;getXRef(), pdfdoc-&gt;getCatalog(), 1, pdfdoc-&gt;getNumPages(), psModePS, marginRight, marginBottom, paperWidth - marginLeft, paperHeight - marginTop, forceRasterize);
+    PSOutputDev *psOut = new PSOutputDev(const_cast&lt;char*&gt;(tf.name().latin1()), const_cast&lt;char*&gt;(pstitlechar), pdfdoc-&gt;getXRef(), pdfdoc-&gt;getCatalog(), 1, pdfdoc-&gt;getNumPages(), psModePS, marginLeft, marginBottom, paperWidth - marginRight, paperHeight - marginTop, forceRasterize);
 
     if (psOut-&gt;isOk())
     {
--- branches/KDE/3.5/kdegraphics/kpdf/xpdf/xpdf/PSOutputDev.cc #708814:708815
@@ -3140,7 +3140,7 @@
       writePSFmt(&quot;{0:.4g} {1:.4g} translate\n&quot;, tx, ty);
     }
     if (xScale != 1 || yScale != 1) {
-      writePSFmt(&quot;{0:.4f} {0:.4f} scale\n&quot;, xScale, yScale);
+      writePSFmt(&quot;{0:.4f} {1:.4f} scale\n&quot;, xScale, yScale);
     }
     if (clipLLX0 &lt; clipURX0 &amp;&amp; clipLLY0 &lt; clipURY0) {
       writePSFmt(&quot;{0:.4g} {1:.4g} {2:.4g} {3:.4g} re W\n&quot;,
</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>21549</attachid>
            <date>2007-09-05 14:35:00 +0000</date>
            <delta_ts>2007-09-05 14:35:00 +0000</delta_ts>
            <desc>Test document to demo this bug: use with kpdf; set margins; print with &quot;Preview&quot; enabled</desc>
            <filename>frames4testing.pdf</filename>
            <type>application/pdf</type>
            <size>2857</size>
            <attacher name="Kurt Pfeifle">pfeifle</attacher>
            
              <data encoding="base64">JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0ZpbHRlci9GbGF0ZURl
Y29kZT4+CnN0cmVhbQp4nI2SOW4DMQxF+zkFaxcCKYlajpHKJ4jTBYibXD8kNdEykYG4kc3P5T/S
CN/HFyCgI+DKLkCJ5Co83+F+g88DXUWqCX5fgufHgVCIXTkLfHJe8x+3Y+4j4dDD8iNC8tI4lypf
W5yDb4mihUV5k0b5HLy+Mp6zS5CTOogFgbkPMsWTeNgJWQdFDaZpVKxqYq+hbqaPtMayCCiInSC5
vBW0oHiU1agVbCv9Y3HE0XGVD1xfG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