+ my $pageb_a4 = sub {
+ $somepage->('B', 0,0, $a4_h, $a4_w );
+ };
+ if ($maxpaper eq 'a3') {
+ $pageb_a4->();
+ my $mt_offset = $bb{PrintableB}[3] - $max_printeredge;
+ $somepage->('MT', 0, $mt_offset, $a4_h, $mt_offset + $a3_h );
+ $bb{PrintableAll} = [
+ @{ $bb{PrintableB} }[0..1],
+ @{ $bb{PrintableMT} }[2..3],
+ ];
+ } elsif ($maxpaper eq 'a4') {
+ $pageb_a4->();
+ my $m_offset = $bb{PrintableB}[3] - $max_printeredge;
+ $somepage->('M', 0, $m_offset, $a4_h, $m_offset + $a4_w );
+ my $t_offset = $bb{PrintableM}[3] - $max_printeredge;
+ $somepage->('T', 0, $t_offset, $a4_h, $t_offset + $a4_w );
+ $bb{PrintableAll} = [
+ @{ $bb{PrintableB} }[0..1],
+ @{ $bb{PrintableT} }[2..3],
+ ];
+ } elsif ($maxpaper =~ m/^a1/) {
+ my $offx = ($a1_w - $bb{Entire}[2] * (1 + $a1sfactor)) / 3;
+ my $offy = 0.5*($a1_h - $bb{Entire}[3]);
+ $somepage->('P', -$offx,-$offy, $a1_w-$offx, $a1_h-$offy);
+ my $hairs = 30 * MM2PT;
+ my $hairsw = $bb{Entire}[2];
+ my $hairsh = $bb{Entire}[3];
+ my $surround = 5 * MM2PT;
+ my $surroundw = $bb{Entire}[2] + $surround*2;
+ my $surroundh = $bb{Entire}[3] + $surround*2;
+ my @hrect = @{ $bb{Entire} };
+ if ($maxpaper eq 'a1m') {
+ @hrect = @{ $submargins->($a1m_pasteedge, \@hrect) };
+ $bb{Cutout} = \@hrect;
+ }
+ my $w_stroke = $xopts =~ m/W/ ?
+ ' gsave 3 setlinewidth stroke grestore '
+ : '';
+ $preamble_from_boundings = <<END;
+ 1 setlinewidth
+ 0 setgray
+ /a1hairs {
+ newpath moveto
+ $hairs 0 rmoveto
+ $hairs -2 mul 0 rlineto
+ $hairs $hairs rmoveto
+ 0 $hairs -2 mul rlineto
+ stroke
+ } def
+ $hrect[0] $hrect[1] a1hairs
+ $hrect[0] $hrect[3] a1hairs
+ $hrect[2] $hrect[3] a1hairs
+ $hrect[2] $hrect[1] a1hairs
+ newpath
+ -$surround -$surround moveto
+ $surroundw 0 rlineto
+ 0 $surroundh rlineto
+ -$surroundw 0 rlineto
+ closepath $w_stroke clip
+END
+ $adjuncts_dy_from_boundings{Top} = $c{PA}{BoundingsA1dy}[0];
+ $adjuncts_dy_from_boundings{Bottom} = $c{PA}{BoundingsA1dy}[1];
+ # ^ if we are doing it all in one go we lose less printable area
+ } else {
+ confess;
+ }