Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add test for issue #120 #124

Closed
wants to merge 1 commit into from
Closed

add test for issue #120 #124

wants to merge 1 commit into from

Conversation

mojoaxel
Copy link
Collaborator

@mojoaxel mojoaxel commented Sep 3, 2023

@mojoaxel
Copy link
Collaborator Author

The tests are failing with this error message:

 FAIL  test/issues.test.js
  ● Console

    console.warn
      Trying to parse invalid object: {"line":34,"column":6,"offset":19800})

      at PDFParser.Object.<anonymous>.PDFParser.tryToParseInvalidIndirectObject (node_modules/pdf-lib/src/core/parser/PDFParser.ts:185:13)
      at PDFParser.<anonymous> (node_modules/pdf-lib/src/core/parser/PDFParser.ts:224:14)
      at step (node_modules/tslib/tslib.js:141:27)
      at Object.throw (node_modules/tslib/tslib.js:122:57)
      at rejected (node_modules/tslib/tslib.js:113:69)

    console.warn
      Invalid object ref: 22 0 R

      at PDFParser.Object.<anonymous>.PDFParser.tryToParseInvalidIndirectObject (node_modules/pdf-lib/src/core/parser/PDFParser.ts:189:13)
      at PDFParser.<anonymous> (node_modules/pdf-lib/src/core/parser/PDFParser.ts:224:14)
      at step (node_modules/tslib/tslib.js:141:27)
      at Object.throw (node_modules/tslib/tslib.js:122:57)
      at rejected (node_modules/tslib/tslib.js:113:69)

  ● issues › merge a encrypted pdf (#120)

    Expected instance of PDFDict, but got instance of undefined

      57 |     const src = await this._getInputAsBuffer(input)
      58 |     const srcDoc = await PDFDocument.load(src, this.loadOptions)
    > 59 |     const pageIndices = srcDoc.getPageIndices()
         |                                ^
      60 |
      61 |     const copiedPages = await this.doc.copyPages(srcDoc, pageIndices)
      62 |     copiedPages.forEach((page) => {

      at new UnexpectedObjectTypeError (node_modules/pdf-lib/src/core/errors.ts:31:5)
      at PDFContext.Object.<anonymous>.PDFContext.lookup (node_modules/pdf-lib/src/core/PDFContext.ts:166:11)
      at PDFCatalog.Object.<anonymous>.PDFDict.lookup (node_modules/pdf-lib/src/core/objects/PDFDict.ts:143:38)
      at PDFCatalog.Object.<anonymous>.PDFCatalog.Pages (node_modules/pdf-lib/src/core/structures/PDFCatalog.ts:24:17)
      at Cache.PDFDocument.computePages [as populate] (node_modules/pdf-lib/src/api/PDFDocument.ts:1366:18)
      at Cache.Object.<anonymous>.Cache.access (node_modules/pdf-lib/src/utils/Cache.ts:17:40)
      at PDFDocument.Object.<anonymous>.PDFDocument.getPages (node_modules/pdf-lib/src/api/PDFDocument.ts:557:27)
      at PDFDocument.Object.<anonymous>.PDFDocument.getPageCount (node_modules/pdf-lib/src/api/PDFDocument.ts:540:61)
      at PDFDocument.Object.<anonymous>.PDFDocument.getPageIndices (node_modules/pdf-lib/src/api/PDFDocument.ts:591:26)
      at PDFMerger.getPageIndices [as _addEntireDocument] (index.js:59:32)
      at PDFMerger.add (index.js:21:7)
      at Object.<anonymous> (test/issues.test.js:42:5)

It looks to me like this is an issue in the pdf-lib we can not do anything about:
Hopding/pdf-lib#1274

@mojoaxel
Copy link
Collaborator Author

There is an issue with the provided pdf document from #120
Looks like this is a pdf-lib problem, we can not solve and that has nothing to do with #120 / #88

@mojoaxel mojoaxel closed this Dec 25, 2023
@mojoaxel mojoaxel added pdf-lib This problem was comes from pdf-lib and should be solved there bug Something isn't working labels Dec 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pdf-lib This problem was comes from pdf-lib and should be solved there
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant