From b0fe0f41db656352dba57d9e1b2e56ea8395bdc1 Mon Sep 17 00:00:00 2001 From: Rob Wu Date: Mon, 19 Mar 2018 16:44:32 +0100 Subject: [PATCH 1/2] [docs] Link to other examples from examples page --- docs/contents/examples/index.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/contents/examples/index.md b/docs/contents/examples/index.md index 5967b24f6..635c7f5ee 100644 --- a/docs/contents/examples/index.md +++ b/docs/contents/examples/index.md @@ -9,6 +9,9 @@ template: layout.jade PDF.js heavily relies on the use of [Promises](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise). If promises are new to you, it's recommended you become familiar with them before continuing on. +This tutorial shows how PDF.js can be used as a library in a web browser. +[examples/](https://github.com/mozilla/pdf.js/tree/master/examples) provides more examples, including usage in Node.js (at [examples/node/](https://github.com/mozilla/pdf.js/tree/master/examples/node)). + ### Document The object structure of PDF.js loosely follows the structure of an actual PDF. At the top level there is a document object. From the document, more information and individual pages can be fetched. To get the document: From 362da3bc050dabf3e9e4bb6cfaad51e94a04373c Mon Sep 17 00:00:00 2001 From: Rob Wu Date: Mon, 19 Mar 2018 16:44:54 +0100 Subject: [PATCH 2/2] Use pdfjsLib instead of PDFJS in examples pdfjsLib is used in PDF.js 2.x, PDFJS was the old namespace from 1.x. --- docs/contents/examples/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/contents/examples/index.md b/docs/contents/examples/index.md index 635c7f5ee..31e1b5763 100644 --- a/docs/contents/examples/index.md +++ b/docs/contents/examples/index.md @@ -17,13 +17,13 @@ This tutorial shows how PDF.js can be used as a library in a web browser. The object structure of PDF.js loosely follows the structure of an actual PDF. At the top level there is a document object. From the document, more information and individual pages can be fetched. To get the document: ```js -PDFJS.getDocument('helloworld.pdf') +pdfjsLib.getDocument('helloworld.pdf') ``` Remember though that PDF.js uses promises, so the above will return a promise that is resolved with the document object. ```js -PDFJS.getDocument('helloworld.pdf').then(function(pdf) { +pdfjsLib.getDocument('helloworld.pdf').then(function(pdf) { // you can now use *pdf* here }); ```