Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

[Bug]: It's diffrent between text_layer.js and getTextContent to get the ascent/descent #19104

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

Closed
luckymore opened this issue Nov 26, 2024 · 0 comments

Comments

@luckymore
Copy link

Attach (recommended) or Link to PDF file

I found this PR for text layer text offset, recalculating ascent and descent.
#12896

But the ratio calculated by the property ascent/(ascent + descent) in getTextContent does not match.

Which is the right way?

Web browser and its version

chrome 130.0.6723.70

Operating system and its version

macOS 14.1 (23B2073)

PDF.js version

latest

Is the bug present in the latest PDF.js version?

Yes

Is a browser extension

No

Steps to reproduce the problem

P1
https://www.mckinsey.com/~/media/mckinsey/business%20functions/mckinsey%20digital/our%20insights/the%20economic%20potential%20of%20generative%20ai%20the%20next%20productivity%20frontier/the-economic-potential-of-generative-ai-the-next-productivity-frontier.pdf

What is the expected behavior?

The logic is consistent in both places

What went wrong?

Calculations using the ascent attribute in getTextContent will be slightly offset
image

Using the calculations in the text layer is more accurate
image

Link to a viewer

No response

Additional context

No response

@mozilla mozilla locked and limited conversation to collaborators Nov 26, 2024
@Snuffleupagus Snuffleupagus converted this issue into discussion #19105 Nov 26, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant