[l2h] patches and bugs in pstoimg

Hamish hamish_b at yahoo.com
Thu Feb 17 13:08:07 CET 2011


first a patch for debian wish #247150: pad -multipage output with zeros
more info here:  http://bugs.debian.org/latex2html

the following patch has a look at how many output files there will be and
pads as many zeros as needed/when needed. Also it separates the counter
from the filename with an underscore.

patch is against pstoimg from latex2html version 2008-debian1-5 (Squeeze).

--- /usr/bin/pstoimg    2011-02-08 19:46:54.037904248 +1300
+++ pstoimg.pad 2011-02-17 23:28:16.571866070 +1300
@@ -911,11 +911,14 @@
     my @list = grep(/^\d+_${pnmbase}\.pnm/,readdir(DIR));
     if(@list) {
+      sub log10 { log($_[0]) / log(10) }
+      my $len = int(log10(@list))+1;
       my $i;
       foreach $i (@list) {
         my ($n) = $i =~ /^(\d+)_/;
+        my $n_pad = sprintf("%0${len}d", $n);
         my $j = $outfile;
-        $j =~ s|(\.[^/.]*)$|$n$1|;
+        $j =~ s|(\.[^/.]*)$|_$n_pad$1|;
        if(crop_scale_etc("$pnmdir$i", $j)) {
           L2hos->Unlink("$pnmdir$i") unless($opt{debug});

next is a work around for debian bug #612126: -flip is ignored:
I found a bug in Lenny's pstoimg, the -flip option is totally ignored.
Not tested in Squeeze, but I don't see any bug reports about it.

I can work around it by editing the perl script and forcibly flushing the $cmd
pipe at the end of the "if($opt{flip}) {" segment,

+  if($cmd) {
+    # empty command pipe, we need the image's geometry
+    &do_cmd($in,$tmp,$cmd);
+    $cmd='';
+  }

but as a general solution for the bug I wonder what else could have been in the 
forgotten $cmd string? or is it being clobbered instead of forgotten?
It seems the "-crop" option may be victim to the same thing.

finally I have no solution for debian bug #613800: -multipage with
-geometry and -margins goes haywire,
The -geometry and -margins options work well for me on a single page
PostScript file. But if I try them with a multipage postscript file the
resulting images jump all over the place in the final image. It's as if
some origin variable is not reset to 0,0 between each page or something.
If I just use -multipage without the -geometry and -margins options it
works well.



More information about the latex2html mailing list