X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.db-test.git;a=blobdiff_plain;f=yarrg%2Fweb%2Fautohandler;fp=yarrg%2Fweb%2Fautohandler;h=f69ef55a53d92529c3a68f29d673e4238504d2ed;hp=55b9a93695552295b4899d5a52fd0fd5ca4f3651;hb=764f11c76036161975282b87c4cc4298be5d1088;hpb=f7c3c04f684b0e9cac4518beeece11853ef75109 diff --git a/yarrg/web/autohandler b/yarrg/web/autohandler index 55b9a93..f69ef55 100644 --- a/yarrg/web/autohandler +++ b/yarrg/web/autohandler @@ -38,10 +38,18 @@ 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); + $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 +60,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 $@";