pull request # 8724μμ λ¨μΌ νμ΄μ§ λ·°μ΄κ° ꡬνλμμ΅λλ€. μ΄ λ·°μ΄λ₯Ό μ¬μ©νλ λ°©λ²μ 보μ¬μ£Όλ examples
ν΄λμ κ΅¬μ± μμ μμ κ° μμΌλ©΄ μ’μ κ²μ
λλ€.
μλ
νμΈμ! μ΄ λ¬Έμ λ₯Ό ν΄κ²°νκ³ μΆμ΅λλ€. Githubμμ λ¬Έμ λ₯Ό ν΄κ²°νλ κ²μ μ΄λ²μ΄ μ²μμ΄λ―λ‘ μμνλ λ°©λ²μ μμλΌ μ μλλ‘ λμ μ£Όμλ©΄ μ’κ² μ΅λλ€.
μ΄λ―Έ gulp μλ²λ‘ μ€νλλ λ‘컬 볡μ¬λ³Έμ΄ μμ΅λλ€.
https://github.com/mozilla/pdf.js/tree/master/examples/components ν΄λμ κ΅¬μ± μμ μμ κ° μμ΅λλ€. μ΄ ν¨μΉμ λͺ©μ μ PDFSinglePageViewer
λ₯Ό μ¬μ©νλ μμ λ₯Ό μΆκ°νλ κ²μ
λλ€. λ€λ₯Έ μμ μ λ§μ°¬κ°μ§λ‘ κΈ°λ³Έ Tracemonkey PDF νμΌ λ§λ‘λ ν μ μμ΅λλ€.
κ°μ¬! λλ μ΄κ²μ λν΄ λ Έλ ₯ν κ²μ΄λ€.
κ·Έλμ λλ μ¬κΈ°μ μ½κ° νΌλμ€λ¬μνκ³ μμ΅λλ€. μ΄κ²μ΄ λ΄κ° μ΄ν΄ ν κ²μ
λλ€.
κ΅¬μ± μμ ν΄λμμ pageviewer.jsλ pdf_page_view.jsλ₯Ό μ¬μ©νμ¬ pdf νμΌμ μ μμ μΌλ‘ νμνλ μμ μ
λλ€. pdf_single_page_viewer.jsλ₯Ό μ¬μ©νλ singlepageviewer.jsμ κ°μ μμ λ₯Ό λ§λ€μ΄μΌν©λλ€.
λλ μ§κΈκΉμ§ μ¬λ°λ₯Έ κΈΈμ κ°κ³ μλκ°?
κΈ°λ³Έμ μΌλ‘ μ΄κ²μ΄ λ¨μΌ νμ΄μ§ λ·°μ΄λ₯Ό μ¬μ©νλλ‘ pageviewer.js νμΌμμ νΈμ§ν΄μΌνλ κ²μ λκΉ?
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();
});
λ€μμ singlepageviewer.jsκ° νΈμ§ λ λΆλΆμΌλ‘ ν¬ν¨νλ λ΄μ©μ λλ€.
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();
});
μ§κΈκΉμ§μ μ κ·Ό λ°©μμ΄ μλ―Έκ° μμ΅λκΉ?
μκ° λ΄ μ£Όμ μ κ°μ¬ν©λλ€!
μ μ ν νμμΌλ‘ λκΈμ λ€μ κ²μν©λλ€.
κ΅¬μ± μμ ν΄λμμ pageviewer.jsλ pdf_page_view.jsλ₯Ό μ¬μ©νμ¬ pdf νμΌμ μ μμ μΌλ‘ νμνλ μμ μ λλ€. pdf_single_page_viewer.jsλ₯Ό μ¬μ©νλ singlepageviewer.jsμ κ°μ μμ λ₯Ό λ§λ€μ΄μΌν©λλ€.
PDFSinglePageViewer
λ https://github.com/mozilla/pdf.js/blob/master/examples/components/simpleviewer.js μ μ μμ λ₯Ό κΈ°λ°μΌλ‘ PDFViewer
κ³Ό λμΌν μΈν°νμ΄μ€λ₯Ό ꡬννλ€λ μ μ κ³ λ € νμμμ€. ν¨μ¬ λ μ μ ν μΆλ°μ μ΄ λ κ²μ
λλ€.
κ·Έ μ‘°μΈμ κ°μ¬λ립λλ€!
https://github.com/mozilla/pdf.js/pull/8989 ν μμ²μ μ μΆνμ΅λλ€
νΈμ§νλ€:
μ¬κΈ°μ λκ° λΉ μ‘λμ§ λͺ¨λ₯΄κ² μ§λ§ κ΅¬μ± μμ μμ μ€ http://localhost:8888/examples/components/{anyfile}.html
μ λΈλΌμ°μ μ μ무κ²λ νμλμ§ μμ΅λλ€. μ½μμ λ€μ μ€λ₯κ° νμλ©λλ€.
singlepageviewer.html:38 GET http://localhost:8888/node_modules/pdfjs-dist/web/pdf_viewer.css net::ERR_ABORTED
singlepageviewer.html:40 GET http://localhost:8888/node_modules/pdfjs-dist/build/pdf.js net::ERR_ABORTED
singlepageviewer.html:41 GET http://localhost:8888/node_modules/pdfjs-dist/web/pdf_single_page_viewer.js net::ERR_ABORTED
singlepageviewer.js:18 Uncaught ReferenceError: PDFJS is not defined
at singlepageviewer.js:18
μ¬κΈ°μ λκ° λΉ μ‘λμ§ λͺ¨λ₯΄κ² μ§λ§ http : // localhost : 8888 / examples / components / {anyfile} .htmlμ λΈλΌμ°μ μ μ무κ²λ νμλμ§ μλ κ΅¬μ± μμ μμ κ° μμ΅λλ€. μ½μμ λ€μ μ€λ₯κ° νμλ©λλ€.
μμ μ *.js
νμΌμμ μΈκΈνλ―μ΄, μλ₯Ό λ€μ΄ μ¬κΈ°λ₯Ό μ°Έμ‘°νμμμ€. gulp dist-install
νμ΅λκΉ?
κ°μ¬ν©λλ€!
λ€μμ κ²ν ν λͺ¨λ λ³κ²½ μ¬νμ ν¬ν¨νκ³ Contributing and Squashing Commits wikiμ λ°λ₯Έ pull μμ²μ
λλ€ : https://github.com/mozilla/pdf.js/pull/8990
μκ° λ΄ μ£Όμ
μ κ°μ¬ν©λλ€!
κ°μ₯ μ μ©ν λκΈ
PDFSinglePageViewer
λ https://github.com/mozilla/pdf.js/blob/master/examples/components/simpleviewer.js μ μ μμ λ₯Ό κΈ°λ°μΌλ‘PDFViewer
κ³Ό λμΌν μΈν°νμ΄μ€λ₯Ό ꡬννλ€λ μ μ κ³ λ € νμμμ€. ν¨μ¬ λ μ μ ν μΆλ°μ μ΄ λ κ²μ λλ€.