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
Compose an example for the single page viewer #8951
Comments
Hi! I'd like to address this issue. This is my first time solving an issue on Github so I'd love it if you could help me to figure out how to get started. |
There are component examples in the https://github.com/mozilla/pdf.js/tree/master/examples/components folder. The objective of this patch is to add an example that uses |
Thanks! I'll try to work on this. |
So, I'm getting a little confused here. This is what I understood: Am I along the right path so far? So basically is this what I need to edit from the pageviewer.js file so that it makes use of the single page viewer? return pdfDocument.getPage(PAGE_TO_VIEW).then(function (pdfPage) {
// Creating the page view with default parameters.
var pdfPageView = new PDFJS.PDFPageView({
container: container,
id: PAGE_TO_VIEW,
scale: SCALE,
defaultViewport: pdfPage.getViewport(SCALE),
// We can enable text/annotations layers, if needed
textLayerFactory: new PDFJS.DefaultTextLayerFactory(),
annotationLayerFactory: new PDFJS.DefaultAnnotationLayerFactory()
});
// Associates the actual page with the view, and drawing it
pdfPageView.setPdfPage(pdfPage);
return pdfPageView.draw();
}); Here is what singlepageviewer.js contains as the edited portion: return pdfDocument.getPage(PAGE_TO_VIEW).then(function (pdfPage) {
// Creating the page view with default parameters.
var pdfSinglePageView = new PDFJS.PDFSinglePageViewer({
container: container,
id: PAGE_TO_VIEW,
scale: SCALE,
defaultViewport: pdfPage.getViewport(SCALE),
// We can enable text/annotations layers, if needed
textLayerFactory: new PDFJS.DefaultTextLayerFactory(),
annotationLayerFactory: new PDFJS.DefaultAnnotationLayerFactory()
});
// Associates the actual page with the view, and drawing it
pdfSinglePageView.setPdfPage(pdfPage);
return pdfSinglePageView.draw();
}); Is my approach so far making sense? Thanks a lot for your time! Reposting comment with proper formatting. |
Considering that |
Thanks for that advice! Edit:
|
As mentioned in the |
Got it thanks! |
Added component example for single page viewer
In pull request #8724 a single page viewer has been implemented. It would be nice to have a components example in the
examples
folder that demonstrates how to use this viewer.The text was updated successfully, but these errors were encountered: