From 6276095d9755110225acad11fa7ec75e8364e0f6 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Sat, 14 May 2011 21:57:44 +0200 Subject: fixed bug with margins & nup=2 --- pdftool.pl | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pdftool.pl b/pdftool.pl index 14cad52..57b4f60 100755 --- a/pdftool.pl +++ b/pdftool.pl @@ -55,7 +55,8 @@ The document will be treated as follows: =over 4 -=item * Convert from PDF to PostScript (if necessary), +=item * Convert from PDF to PostScript (if necessary, and only for +smallest interval that contains all the selected pages), =item * Select of the page range, @@ -725,7 +726,7 @@ sub calc_specs { $up = $pageno % $vert; } ($orot,$erot) = ('L','R'); - $xoff = $margin + ($across+1)*$outwidth/$horiz - $hshift; + $xoff = ($across+1)*$outwidth/$horiz - $hshift; } else { if (defined $column) { # column=1; leftright=1; topbottom=1; @@ -736,14 +737,17 @@ sub calc_specs { $across = $pageno % $horiz; $up = $vert-1 - floor($pageno / $horiz); } - $xoff = $margin + $across*$outwidth/$horiz + $hshift; + $xoff = $across*$outwidth/$horiz + $hshift; } - $yoff = $margin + $up*$outheight/$vert + $vshift; + $yoff = $up*$outheight/$vert + $vshift; push @ospecs, sprintf ("%d%s@%.3f(%.3f,%.3f)", - $pageno, $orot, $scale, $xoff, $yoff); + $pageno, $orot, $scale, + $xoff+$margin, $yoff+$margin); push @especs, sprintf ("%d%s@%.3f(%.3f,%.3f)", - $n + $pageno, $erot, $scale, $outwidth-$xoff, $outheight-$yoff); + $n + $pageno, $erot, $scale, + $outwidth-$xoff+$margin, + $outheight-$yoff+$margin); } return (\@ospecs,\@especs); } -- cgit v1.2.3