Subject: | replacing JPGs: works on Win32, doesn't on Linux |
Date: | Tue, 27 Apr 2010 13:48:39 +0200 (W. Europe Daylight Time) |
To: | bug-CAM-PDF [...] rt.cpan.org |
From: | thomas.plass [...] arcor.de (Thomas Plass) |
Hi,
as amazing as CAM::PDF is, it behaves differently under Win32 and
Unix. In particular, replacing JPGs works OK on Win32 but doesn't on
Linux (JPGs are removed but not replaced).
It would appear that with perl on Linux traversing the PDF data
structures does not descend into reference Nodes.
Wrapping some debugging code around the call to replaceObject() on
line 236 in crunchjpgs.pl:
my %newkeys = $doc->replaceObject($objnum, $jpg, 9, 1);
my $msg = "perl $Config::Config{'version'} on $Config::Config{'archname'}: " .
"new keys returned by replaceObject() for \$objnum $objnum:";
for my $k (sort {$a <=> $b} keys %newkeys){ $msg .= "\n $k => $newkeys{$k}";}
print STDERR "$msg\n";
yields for the same input PDF on Win32 (ActiveState perl)
perl 5.8.8 on MSWin32-x86-multi-thread: new keys returned by replaceObject() for $objnum 64:
9 => 64
10 => 74
11 => 75
perl 5.8.8 on MSWin32-x86-multi-thread: new keys returned by replaceObject() for $objnum 66:
9 => 66
10 => 76
11 => 77
perl 5.8.8 on MSWin32-x86-multi-thread: new keys returned by replaceObject() for $objnum 68:
9 => 68
10 => 78
11 => 79
and on Linux:
perl 5.10.0 on i486-linux-gnu-thread-multi: new keys returned by replaceObject() for $objnum 64:
9 => 64
perl 5.10.0 on i486-linux-gnu-thread-multi: new keys returned by replaceObject() for $objnum 66:
9 => 66
perl 5.10.0 on i486-linux-gnu-thread-multi: new keys returned by replaceObject() for $objnum 68:
9 => 68
Any idea or help would be very much appreciated.
Best regards
Thomas