-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Deprecated API usage: renderTextLayer
, please use TextLayer
instead.
#18206
Comments
I think this uage of |
While creating my example, I figured the problem out. The text layer is still present in the DOM, it's just hidden behind the canvas. The new version has some CSS that sets the |
I also ran into this issue. I have to say it is extremely frustrating, there's almost no documentation of any of this stuff so I have to rely on old examples that don't work and then I run into issues like this. The APIs are incredibly leaky, like @JHarrisGTI shows, unless you know which CSS attributes to work the whole thing just doesn't do anything and fails silently. I am actually baffled that there are working examples of this library on the internet, they must have spent months banging their heads against the wall to get it working |
@nsadeh, Please remember that pdf.js is available for free and is maintained by some contributors who are working for free on their spare time. Personally, my main focus is to maintain and develop the Firefox pdf viewer. |
I apologize for the tone of my comment, I was just incredibly frustrated today trying to work with this library and experiencing undocumented, deprecated APIs and leaky abstractions. I saw the Mozilla name and thought that it was officially supported by Mozilla like so many of the great web APIs I use. |
It is OK ,pay attent to the |
Upon upgrading to pdfjs-dist 4.3.136, my text layers have vanished. I see this in the console:
I would like to switch over to the new API. I haven't been able to find any documentation for TextLayer; it was added in this PR, which mentions that TextLayer is similar to AnnotationLayer, but I haven't been able to find docs for that either.
Here's the code I've been using so far for rendering text in my app:
this.viewport
is set tothis.pdfPage.getViewport()
;this.textLayer
is a reference to a<div>
on the page.I replaced the
renderTextLayer()
call with this:This makes the console warning go away, which is good progress, but my text layer still doesn't show up.
How should I go about troubleshooting this? Am I on the right track with
new TextLayer
? Is there an example I should look at?The text was updated successfully, but these errors were encountered: