Closed
Description
Attach (recommended) or Link to PDF file here:
Configuration:
- Web browser and its version: No browser, Node 12.14.1
- Operating system and its version: Ubuntu 20.04
- PDF.js version: [email protected]
- Is a browser extension: No
Steps to reproduce the problem:
- Create a new Adobe Illustrator file.
- Drag an image from your desktop onto the artboard.
- Duplicate the artboard by selecting the artboard tool, select the artboard, copy and paste.
- File > Save a Copy, choose PDF from the format dropdown
- Use Acrobat Pro's "Content Panel" to ensure the images have the same id number.
Here is an example PDF 2page-test.pdf
Here is what it looks like in Acrobat's Content Panel
What is the expected behavior? (add screenshot)
I should be able to extract the image from either page using page.objs.get(name)
without an error.
I find all the image object names using the following code.
const ops = await page.getOperatorList()
const imageNames = ops.fnArray.reduce((acc, curr, i) => {
if (
[pdfjs.OPS.paintImageXObject, pdfjs.OPS.paintJpegXObject].includes(curr)
) {
// console.log(ops.argsArray[i])
acc.push(ops.argsArray[i][0])
}
return acc
}, [])
I then use those names to get the image objects from the page.
const rawImages = imageNames.map((name) => {
return [name, page.objs.get(name)]
})
What went wrong? (add screenshot)
I get the error
Error: Requesting object that isn't resolved yet g_d0_img_p1_1
I logged out the page.objs
for each page and noticed this...
img_p0_1 PDFObjects {
_objs: [Object: null prototype] {
img_p0_1: {
capability: [Object: null prototype],
data: [Object],
resolved: true
}
}
}
g_d0_img_p1_1 PDFObjects {
_objs: [Object: null prototype] {}
}
The second page doesn't have a g_d0_img_p1_1
key in its page.objs
.
Metadata
Metadata
Assignees
Labels
No labels