Skip to content
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

Composed an example for single page viewer in response to issue #8951 #8989

Closed
wants to merge 2 commits into from
Closed

Conversation

pixelexel
Copy link
Contributor

This pull request is in response to issue #8951.
It contains a components example in the examples/components folder for single page viewer.

Copy link
Collaborator

@Snuffleupagus Snuffleupagus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once you've addressed the comments, please remember to squash the commits (https://github.com/mozilla/pdf.js/wiki/Squashing-Commits).

Edit: To more clearly see the difference between the existing pageviewer and simpleviewer examples, and the new one that you add here, you can try to locally use (but don't commit it) var DEFAULT_URL = '../../test/pdfs/issue3115r.pdf'; in the various example *.js files and compare what happens when clicking on the links in that PDF file.


var container = document.getElementById('viewerContainer');

// pdfLinkService not used since single page viewer
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't correct, the whole point of the PDFSinglePageViewer (as opposed to PDFPageView) is that it implements the same interface as PDFViewer (for e.g. PDF files containing links).

Basically, this new file should be an almost verbatim copy of https://github.com/mozilla/pdf.js/blob/master/examples/components/simpleviewer.js, but using PDFJS.PDFSinglePageViewer instead of PDFJS.PDFViewer and var pdfSinglePageViewer instead of var pdfViewer.

pdfSinglePageViewer.setFindController(pdfFindController);

container.addEventListener('pagesinit', function () {
//Changing default scale value
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just keep the same format as the existing comment here, i.e. // We can use pdfSinglePageViewer now, e.g. let's change default scale.

@pixelexel
Copy link
Contributor Author

Thanks for the review.
I've made the changes and intend to make a new pull request with a proper setup after reading the contributing guide thoroughly.
This would make my commit history cleaner. Is that okay or should I update this pull request itself?

@pixelexel pixelexel closed this Oct 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants