Merging 2 PDFs - Invalid key BSISpaces
See original GitHub issueHi,
I have 2 pdfs and I want to merge them to have one document
for (let page of result.getPages()) {
doc.addPage(page);
}
In the second one I have the following line
<</BSISpaces [36 0 R 37 0 R 38 0 R 39 0 R 40 0 R 41 0 R 42 0 R 50 0 R 141 0 R 142 0 R 143 0 R 174 0 R 175 0 R 176 0 R 284 0 R 285 0 R 286 0 R 287 0 R 288 0 R 289 0 R 290 0 R 291 0 R 295 0 R 296 0 R 297 0 R 298 0 R 299 0 R 300 0 R 301 0 R 302 0 R 391 0 R 392 0 R 393 0 R 424 0 R 425 0 R 426 0 R 431 0 R 432 0 R 433 0 R 434 0 R 435 0 R 436 0 R 437 0 R 438 0 R]/Contents 489 0 R/MediaBox [0 0 3370 2384]/Parent 3 0 R/Resources <</ExtGState 8 0 R/Font 21 0 R/Pattern 56 0 R/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]/XObject 68 0 R>>/Type /Page>>
In src/core/pdf-objects/PDFDictionary.ts, the following check throws an error:
if (
validateKeys &&
this.validKeys &&
!this.validKeys.includes(keyName.key)
) {
error(`Invalid key: "${keyName.key}"`);
}
BSISpaces is not includes in validKeys
How are built valid keys ? Does it depend on first document ? I have noticed that if I reverse the merge (document with /BSISpaces is used as base to merge other documents), no error is thrown but the produced document is not readable.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
The second issue is mine 😃 - I will make a PR to remove this check
Like in the case when the document with BSISpaces was used as the base to add other documents. There is maybe 2 issues in this document.