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

getStructTree not available on es5 build? #13423

Closed
A-Babin opened this issue May 22, 2021 · 5 comments
Closed

getStructTree not available on es5 build? #13423

A-Babin opened this issue May 22, 2021 · 5 comments

Comments

@A-Babin
Copy link

A-Babin commented May 22, 2021

Hello!

I'm trying to parse some PDFs in a Node application. In particular, I'm targeting some tables.

I see in the DOM of the web viewer rendering one of my documents that the structTree provides some really useful structural information that would make my life a lot easier, but the Page.getStructTree method is not available on pdfjs-dist es5 build that must be used in Node.js.

Is there any other way I can get the struct tree information in Node?

Thanks!

@timvandermeij
Copy link
Contributor

The last pre-release was is from April 5 and the struct tree logic was merged on April 9 (see #13171) so it's indeed not released. You'll have to wait until the next release, which is likely to happen in the coming week.

@A-Babin
Copy link
Author

A-Babin commented May 22, 2021

Glad to hear that, thank you!

@barsdeveloper
Copy link

barsdeveloper commented Mar 9, 2022

I am trying to inspect what type of information getStructTree contains for a similar purpose. Unfortunately I'm getting null from this method. Any idea why it could be like that?

I'm using rollup and commonjs to use this library

import pdfjs from "pdfjs-dist"
import pdfjsWorker from "pdfjs-dist/build/pdf.worker.entry"

pdfjs.GlobalWorkerOptions.workerSrc = pdfjsWorker

let pdf = await pdfjs.getDocument("test.pdf").promise
let page = await pdf.getPage(3)
let tree = await page.getStructTree()

tree is null

@mootari
Copy link

mootari commented May 31, 2022

@barsdeveloper Structure trees aren't available in every PDF. You can find more details as well as pointers to test cases (like fips-197.pdf) in issue #6269

@avichovatiya67

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants