-
Notifications
You must be signed in to change notification settings - Fork 196
Documentation Request: Using [customPdfViewer] #2853
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
Comments
You're right, there's no demo yet, and that's a shame! However, judging from my source code, I believe the feature works. So let's go one step back. If I get you right, you're trying to replace the default PDF viewer HTML by your custom HTML, but it refuses to do so? BTW, maybe it's simpler and more future-proof to put your buttons on top of the PDF viewer, using CSS magic to place the buttons at the correct position. But that's just guesswork, I don't know anything about your application. |
Thanks for the suggestion! That’s a great approach for single-page viewer mode; in fact, I’ve already implemented something similar in another framework-free app. But for this case, I’m using the PDF viewer in scrolling mode, where each page has its own independent grid. If I overlay the entire viewer with a single grid using CSS, it won’t sync properly when scrolling; the grid would need to dynamically stick to each page and update as the user navigates. That feels more fragile than just replacing the default HTML per page. Still, I appreciate the idea! It’s a solid solution for the right context I hope the code works correctly & I was just missing the correct way to implement it, if so, putting an example here would help |
Oh, yes. You're right, I should have seen this on first read. Well, in that case, What you can do is capture the Now can add your own overlay If the user is zooming or rotating the page, the page is rendered again. I don't know if the old A more pressing issue is that all that happens outside Angular. If you want to have an Angular button - more precisely: if you want to modify attributes when clicking the button - you must notify Angular programmatically that something has changed. As far as I remember, you have two options: |
Sorry for the delayed reply. Regarding (pageRendered), it sounds like a good approach. However, I’m not quite sure why [customPdfViewer] wouldn’t work for that, the overlay isn’t directly attached to the HTML structure of the PDF itself but rather to the page. So while it’s "attached," it’s not a true attachment in that sense hh. This is why I prefer to stay within Angular’s scope instead of diving deep into the DOM, avoiding potential issues with handling clicks as you mentioned in your response. In my case, hovering or clicking on the grid should affect its styles, but zooming or rotating the page shouldn’t impact the original div. (I’m considering rendering the PDF content using HTML instead. I was just looking for the shortest path to achieving a V1.) Here’s the previous framework-free of the app: https://the-ten-readings.github.io (from the bottom bar select page 1 (the page -3 does not have any layer) & hover over the image) |
Whow, beautiful! |
I suggested adding the grid overlay to the PDF pages because you mentioned scrolling. Single-page mode makes everything much easier. But if you want to support scrolling, you need to scroll you overlay with the page. And that's easier if your overlay is part of the page - you have to struggle with the Angular change detection, but scrolling becomes easy. |
Thanks. You're right. I apologize. I thought using the So, the reason for writing this issue no longer exists, but I think it will remain open as a reminder to complete the documentation. Thanks again. |
Oh, come on, there's no reason to apologize. Your train of thought was totally valid, and if you're using single-page mode, I'm pretty much convinced it will work. Plus, you made me aware of a gap in my documentation, and - last not least - you showed me a stunningly beautiful rendering of the Quran. It's me who has to say "thank you"! |
Also see #2829 (comment). Over there, a developer implemented my recommended approach. As mentioned above, your original idea is probably also valid in your particular use-case, I just wanted to add a pointer that might be useful to future readers. |
Documentation Request: Using [customPdfViewer] and Resolving pdf-dummy-components Import
I'm trying to add an interactive layer (grid/list of buttons) on top of a PDF using
customPdfViewer
input but I'm struggling to make the default PDF viewer (ngx-extended-pdf-viewer.component.html: <ng-template #defaultPdfViewer> ...) template work as custom one (so i can add my layer)!(when trying to use , the component was not exported (created a custom module that manually declares/imports pdf-dummy-components, but uncertain if this is the correct approach)
(i just removed all of the properties/parts ('minHeight', <pdf-sidebar #pdfsidebar [sidebarVisible]="sidebarVisible || false", ...) to figure why it does not want to work / I don't know best approach to have this properties and parts by default like using inheritance from ngx-extended-pdf-viewer.component)
Could you please provide documentation/examples for the proper usage of [customPdfViewer] property? or a quick fix or any recommended way to implement interactive overlays)
Thank you
The text was updated successfully, but these errors were encountered: