Skip to content

Commit 85ed401

Browse files
authored
Merge pull request #20409 from calixteman/split_merge_p1
Add the possibility to create a pdf from different ones (bug 1997379)
2 parents 2201777 + bc87f4e commit 85ed401

19 files changed

Lines changed: 1089 additions & 44 deletions

src/core/decode_stream.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,19 @@ class DecodeStream extends BaseStream {
131131
getBaseStreams() {
132132
return this.stream ? this.stream.getBaseStreams() : null;
133133
}
134+
135+
clone() {
136+
// Make sure it has been fully read.
137+
while (!this.eof) {
138+
this.readBlock();
139+
}
140+
return new Stream(
141+
this.buffer,
142+
this.start,
143+
this.end - this.start,
144+
this.dict.clone()
145+
);
146+
}
134147
}
135148

136149
class StreamsSequenceStream extends DecodeStream {

src/core/decrypt_stream.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ class DecryptStream extends DecodeStream {
5252
buffer.set(chunk, bufferLength);
5353
this.bufferLength = newLength;
5454
}
55+
56+
getOriginalStream() {
57+
return this;
58+
}
5559
}
5660

5761
export { DecryptStream };

src/core/document.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ class Page {
178178
);
179179
}
180180

181-
#getBoundingBox(name) {
181+
getBoundingBox(name) {
182182
if (this.xfaData) {
183183
return this.xfaData.bbox;
184184
}
@@ -201,7 +201,7 @@ class Page {
201201
return shadow(
202202
this,
203203
"mediaBox",
204-
this.#getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX
204+
this.getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX
205205
);
206206
}
207207

@@ -210,7 +210,7 @@ class Page {
210210
return shadow(
211211
this,
212212
"cropBox",
213-
this.#getBoundingBox("CropBox") || this.mediaBox
213+
this.getBoundingBox("CropBox") || this.mediaBox
214214
);
215215
}
216216

0 commit comments

Comments
 (0)