We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I receive the "'Figure' element on a single page with no bounding box" (accessibility) error for every image in my PDF.
I am trying to loop through each image, capture its width and height, and set the /Bbox.
/Bbox
I have tried using the following code:
pdfDoc.context.enumerateIndirectObjects().forEach(object => { const pdfObject = object[1] if (!(pdfObject instanceof PDFRawStream)) return const { dict } = pdfObject const type = dict.get(PDFName.of('Type')) if (type === PDFName.of('XObject')) { const subtype = dict.get(PDFName.of('Subtype')) if (subtype === PDFName.of('Image')) { const width = dict.get(PDFName.of('Width')) const height = dict.get(PDFName.of('Height')) pdfObject.dict.set(PDFName.of('BBox'), new PDFArray([new PDFNumber(0), new PDFNumber(0), new PDFNumber(width), new PDFNumber(height)]) ) } } })
The error persists in the PDF after I try to set the Bounding Box.
What I would expect is for the Missing Bounding Box Error to go away.
Sample PDF:
How to Freeze Your Credit - NerdWallet.pdf
1.17.1
Node
No response
The text was updated successfully, but these errors were encountered:
Note: I am checking the PDF using the PAC 2021 (accessibility) checker.
Sorry, something went wrong.
No branches or pull requests
What were you trying to do?
I receive the "'Figure' element on a single page with no bounding box" (accessibility) error for every image in my PDF.
I am trying to loop through each image, capture its width and height, and set the
/Bbox
.How did you attempt to do it?
I have tried using the following code:
What actually happened?
The error persists in the PDF after I try to set the Bounding Box.
What did you expect to happen?
What I would expect is for the Missing Bounding Box Error to go away.
How can we reproduce the issue?
Sample PDF:
How to Freeze Your Credit - NerdWallet.pdf
Version
1.17.1
What environment are you running pdf-lib in?
Node
Checklist
Additional Notes
No response
The text was updated successfully, but these errors were encountered: