1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
Description: Sort dictionary keys during PDF output, for predictability
Origin: upstream, https://bitbucket.org/ssimms/pdfapi2/commits/2885c70ebf0fc8a7ea3e2f608e398b7de5f53860
Bug-Debian: http://bugs.debian.org/739943
Forwarded: not-needed
Last-Update: 2014-02-24
Applied-Upstream: 2.020
diff --git a/lib/PDF/API2/Basic/PDF/Dict.pm b/lib/PDF/API2/Basic/PDF/Dict.pm
--- a/lib/PDF/API2/Basic/PDF/Dict.pm
+++ b/lib/PDF/API2/Basic/PDF/Dict.pm
@@ -122,8 +122,8 @@
$fh->print(" ");
}
}
- while (($key, $val) = each %{$self})
- {
+ foreach $key (sort keys %$self) {
+ $val = $self->{$key};
next if ($key =~ m/^[\s\-]/o || $specs{$key});
next if (($val || '') eq '');
$key = PDF::API2::Basic::PDF::Name::string_to_name ($key, $pdf);
diff --git a/t/annotate.t b/t/annotate.t
--- a/t/annotate.t
+++ b/t/annotate.t
@@ -18,5 +18,5 @@
# why the Contents section doesn't just have the simple text. I think
# it would be better to only use UTF-8 when necessary.
like($pdf->stringify(),
- qr{/Annot /Subtype /Text /Rect \[ 72 144 172 244 \] /Contents <FEFF005400680069007300200069007300200061006E00200061006E006E006F0074006100740069006F006E>},
+ qr{/Annot /Subtype /Text /Border \[ 0 0 0 \] /Contents <FEFF005400680069007300200069007300200061006E00200061006E006E006F0074006100740069006F006E> /Rect \[ 72 144 172 244 \]},
q{Text Annotation in a rectangle});
diff --git a/t/outline.t b/t/outline.t
--- a/t/outline.t
+++ b/t/outline.t
@@ -15,5 +15,5 @@
$outline->title('Test Outline');
$outline->dest($page2);
-like($pdf->stringify, qr{/Dest \[ 6 0 R /XYZ null null null \] /Title \(Test Outline\) /Parent 7 0 R},
+like($pdf->stringify, qr{/Dest \[ 6 0 R /XYZ null null null \] /Parent 7 0 R /Title \(Test Outline\)},
q{Basic outline test});
diff --git a/t/pdf.t b/t/pdf.t
--- a/t/pdf.t
+++ b/t/pdf.t
@@ -97,6 +97,6 @@
$pdf = PDF::API2->new();
$pdf->{'forcecompress'} = 0;
$pdf->pageLabel(0, { -prefix => 'Test' });
-like($pdf->stringify(), qr{/PageLabels << /Nums \[ 0 << /S /D /P \(Test\) >> \] >>},
+like($pdf->stringify(), qr{/PageLabels << /Nums \[ 0 << /P \(Test\) /S /D >> \] >>},
q{Page Numbering: Decimal Characters (implicit), with prefix});
|