Bug#753239: [tex-live] bug in thumbpdf? - PATCH
On Tue, 15 Jul 2014, Norbert Preining wrote:
> > Patch attached, comments welcome.
>
> Simplified patch.
Even more simplified, this time without seek and tell, which was
what I wanted.
Norbert
------------------------------------------------------------------------
PREINING, Norbert http://www.preining.info
JAIST, Japan TeX Live & Debian Developer
GPG: 0x860CDC13 fp: F7D8 A928 26E3 16A1 9FA0 ACF0 6CAC A448 860C DC13
------------------------------------------------------------------------
--- thumbpdf.pl.orig 2014-07-13 16:24:53.823731368 +0900
+++ thumbpdf.pl 2014-07-15 01:41:58.342957837 +0900
@@ -937,6 +937,16 @@
$objno[$count] = $1;
$getobjindex[$1] = $count;
$objdict[$count] = ($2); # boolean (if $2 exists)
+ if (!$objdict[$count]) {
+ # check for << on thext line, new PDF-X/2014
+ $_ = <PDF>;
+ if (/^<<$/) {
+ $objdict[$count] = 1;
+ $lineno++;
+ $_ = <PDF>;
+ $lineno++;
+ }
+ }
my $stream = 0;
print "* obj $objno[$count]" .
(($objdict[$count]) ? " (dict)" : "") .
@@ -944,18 +954,18 @@
# get obj
$objtext[$count] = "";
- while (<PDF>)
+ while ($_)
{
- $lineno++;
-
if ($objdict[$count])
{
if (/^>>/)
{
last if /^>>\s+endobj$/; # obj without stream
- # get stream
$_ = <PDF>; $lineno++;
+ last if /^endobj$/; # obj without stream, new PDF-X/2014
+
+ # get stream
/^stream$/ or die "$Error `stream' expected on line $lineno!\n";
print "* stream\n" if $::opt_debug;
@@ -982,6 +992,9 @@
last if /^endobj$/;
}
$objtext[$count] .= $_;
+
+ $_ = <PDF>;
+ $lineno++;
}
$count++;
}
Reply to: