diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl index 594a1463c..d3d01105b 100644 --- a/src/devices/gropdf/gropdf.pl +++ b/src/devices/gropdf/gropdf.pl @@ -318,6 +318,11 @@ elsif (exists($ppsz{$papersz})) { @defaultmb=@mediabox=(0,0,$ppsz{$papersz}->[0],$ppsz{$papersz}->[1]); } +elsif (substr($papersz,-1) eq 'l' and exists($ppsz{substr($papersz,0,-1)})) +{ + # Note 'legal' ends in 'l' but will be caught above + @defaultmb=@mediabox=(0,0,$ppsz{substr($papersz,0,-1)}->[1],$ppsz{substr($papersz,0,-1)}->[0]); +} my (@dt)=localtime($ENV{SOURCE_DATE_EPOCH} || time); my $dt=PDFDate(\@dt); @@ -1484,6 +1489,22 @@ sub FixRect return if !defined($rect); $rect->[1]=GraphY($rect->[1]); $rect->[3]=GraphY($rect->[3]); + + if ($rot) + { + ($rect->[0],$rect->[1])=Rotate($rect->[0],$rect->[1]); + ($rect->[2],$rect->[3])=Rotate($rect->[2],$rect->[3]); + } +} + +sub Rotate +{ + my ($tx,$ty)=(@_); + my $theta=rad($rot); + + ($tx,$ty)=(d3($tx * cos(-$theta) - $ty * sin(-$theta)), + d3($tx * sin($theta) + $ty * cos($theta))); + return($tx,$ty); } sub GetPoints