-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0001-pdftopdf-add-newline-to-avoid-mangling.patch
64 lines (56 loc) · 1.71 KB
/
0001-pdftopdf-add-newline-to-avoid-mangling.patch
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
52
53
54
55
56
57
58
59
60
61
62
63
64
From 7992eb7c6e4abeffd766f54c98cbb2cbb45c5c04 Mon Sep 17 00:00:00 2001
From: Sergio <[email protected]>
Date: Thu, 12 Sep 2024 15:18:53 -0500
Subject: [PATCH] pdftopdf: Add newline after each content stream in
::provideStreamData (#587)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
When concatenating the data streams for the page's contents, add a new
line at the end of each data stream to avoid cases where the
concatenation might result in a corruption.
Eg (extracted from a real pdf):
%% Contents for page 1
%% Stream 1
9 0 obj
<<
/Length 10 0 R
>>
stream
q
endstream
endobj
10 0 obj
1
endobj
%% Stream 2
11 0 obj
<<
/Length 12 0 R
>>
stream
q 0.1 0 0 0.1 0 0 cm
the output pdf results in
qq 0.1 0 0 0.1 0 0 cm
with the effect that 'qq' is not being parsed correctly, effectively
mangling the contents.
Signed-off-by: Sergio Gómez <[email protected]>
---
filter/pdftopdf/qpdf_xobject.cc | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/filter/pdftopdf/qpdf_xobject.cc b/filter/pdftopdf/qpdf_xobject.cc
index cc33f43a5..12732f1e9 100644
--- a/filter/pdftopdf/qpdf_xobject.cc
+++ b/filter/pdftopdf/qpdf_xobject.cc
@@ -29,8 +29,10 @@ void CombineFromContents_Provider::provideStreamData(int objid, int generation,
{
Pl_Concatenate concat("concat", pipeline);
const int clen=contents.size();
- for (int iA=0;iA<clen;iA++) {
+ for (int iA=0;iA<clen;iA++)
+ {
contents[iA].pipeStreamData(&concat, true, false, false);
+ concat << "\n";
}
concat.manualFinish();
}