intbot / ng2-pdfjs-viewer

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

How to direct to a certain page programmatically #17

Closed jiangyh1024 closed 5 years ago

jiangyh1024 commented 6 years ago

How to direct to a certain page programmatically. For example, if I set the pageNumber, it should direct to that page

Sri2468 commented 5 years ago

Any update on this feature

codehippie1 commented 5 years ago

Unfortunately, not much updates yet. I am quite occupied and possibly gets this done in early december.

Sri2468 commented 5 years ago

Thanks

codehippie1 commented 5 years ago

@Sri2468 I picked up this item. Might need few changes on underlying pdfjs js files. Will provide an update as soon as this is implemented.

codehippie1 commented 5 years ago

@jiangyh1024 @Sri2468 - This is implemented. Not only you would be able to go to a specific page, added a feature to go to named destination(section) as well. Also you may choose to go to last page using another feature(For a signature, maybe?)

vishnu-dev commented 5 years ago

@codehippie1 Can I know how to use this feature? Or could you point me to where exactly it is in the documentation?

codehippie1 commented 5 years ago

@vishnu-dev Please ask how to questions on Stackoverflow. Which would also benefit others using the component. I barely look at comments on closed issues. It is your lucky day. :-)

You can see the below code in sampleapp provided in the repository - https://github.com/intbot/ng2-pdfjs-viewer/blob/master/SampleApp/src/app/app.component.html Use attribute [page]=2

<div style="position:fixed; left:845px; width: 1000px; height: 900px">
  <ng2-pdfjs-viewer #embeddedPdfViewer pdfSrc="gre_research_validity_data.pdf" [page]=2 locale="de-AT" cursor="HAND" downloadFileName="research.pdf" scroll="W" spred="E" [print]="false" [errorOverride]="true" errorMessage="My error Message"></ng2-pdfjs-viewer>
</div>
vishnu-dev commented 5 years ago

This is static. I need it to be dynamic, i.e on fire of an event I change the page_number variable and it updates the view. Is it possible?

I think ng2-pdfjs-viewer doesn't have this capability. I have found a workaround for the same and I am using it.

If you want me to move this conversation elsewhere, please direct me in the correct direction. @codehippie1

codehippie1 commented 5 years ago

@vishnu-dev As stated in the other issue, this is integrated into the component. I also exposed PDFViewerApplicationOptions and PDFViewerApplication. This will allow everyone to access a lot more hidden features and change them programmatically. So, not just page numer, a lot can be changed directly once the document is loaded. Have fun!!!!

vishnu-dev commented 5 years ago

Thanks, @codehippie1. BTW this is the related issue. #39

codehippie1 commented 5 years ago

Closing as per comment