X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;ds=sidebyside;f=yarrg%2Fweb%2Fautohandler;h=8096e66a61ba23b41181904fab5b596c5a2a5405;hb=29010a75143814a91b4f5200454bea879280e7c1;hp=55b9a93695552295b4899d5a52fd0fd5ca4f3651;hpb=f7c3c04f684b0e9cac4518beeece11853ef75109;p=ypp-sc-tools.db-test.git diff --git a/yarrg/web/autohandler b/yarrg/web/autohandler index 55b9a93..8096e66 100644 --- a/yarrg/web/autohandler +++ b/yarrg/web/autohandler @@ -38,10 +38,19 @@ use CommodsWeb; my $printable= printable($m); -if ($printable eq 'pdf' || $printable eq 'ps') { +if ($printable =~ m/^pdf|^ps/) { my $output; my $got= $m->call_self(\$output); if ($got) { + my @htargs= qw(htmldoc --continuous --gray --size 210x279mm + --left 1cm --right 1cm); + $printable =~ m/^[a-z]+/; + push @htargs, '-t',$&; + if ($printable =~ m/2$/) { + push @htargs, qw(--nup 2); + } + push @htargs, qw(-); + my $tmpfile= IO::File::new_tmpfile(); print $tmpfile $output or die $!; $tmpfile->flush() or die $!; @@ -52,8 +61,8 @@ if ($printable eq 'pdf' || $printable eq 'ps') { eval { $ENV{'HTMLDOC_NOCGI'}=1; open STDIN, '<&', $tmpfile or die $!; - exec qw(htmldoc -t),$printable,qw( - --continuous --gray --size 210x279mm -); + + exec @htargs; die $!; }; print STDERR "HTMLDOC FAILURE $@"; @@ -85,5 +94,11 @@ $r->content_type('text/html; charset=UTF-8'); which contains mostly contributions from YARRG users and is not covered by the AGPL. --> - + % $m->call_next();