intbot / ng2-pdfjs-viewer

An angular component for PDFJS and ViewerJS (Supports all versions of angular)
Apache License 2.0
231 stars 114 forks source link

nameddest is not working with a reference variable - data binding #65

Open ishanuda opened 4 years ago

ishanuda commented 4 years ago

Hi, Thanks for the amazing library.

I would like to know about the nameddest

I tried to set the nameddest using a variable, and when I change the variable dynamically, the page does not scroll to the destination.

Note: When loading the first time with setting the nameddest variable, The page scrolls the PDF to the destination.

I think it is not supporting data binding or is it? or Am I using the nameddest wrong way?

Feature request: If it is not supporting data binding, Can you make this to bind a variable and act accordingly when changing the variable dynamically?

Tested on

Angualar 8 "ng2-pdfjs-viewer": "^5.0.5",

Thank you very much

codehippie1 commented 4 years ago

@ishanuda As you could see, I have exposed PDFViewerApplication object and its options. This can be used to access internal methods to work with pdf directly.

For example PDFViewerApplication .PDFLinkService.navigateTo() method can be used to navigate the document with nameddest as a parameter.

Please check the code inside viewer.js to see how this function works in case you are interested.

ishanuda commented 4 years ago

Hi, Thank you for the quick reply and the information.

As you suggest I will try with the given solution, But I would love to see the library supporting the feature so that anyone can use the library without accessing the PDFjs internal API directly.

Regards

codehippie1 commented 4 years ago

@ishanuda I would love to add as many features as possible. Since, This is a single author project and I am allocating most of my time in upgrades and bug fixes and implementing features requested by more than one user. If you would like to contribute to the project, let me know, I would be glad to get some help. :-)