1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Rename the globals to shorter names.

pdfjsDistBuildPdf=pdfjsLib
pdfjsDistWebPdfViewer=pdfjsViewer
pdfjsDistBuildPdfWorker=pdfjsWorker
This commit is contained in:
Brendan Dahl 2018-03-15 13:49:28 -07:00
parent 6662985a20
commit 01bff1a81d
14 changed files with 66 additions and 68 deletions

View file

@ -18,7 +18,7 @@ var PAGE_NUMBER = 1;
var PAGE_SCALE = 1.5;
var SVG_NS = 'http://www.w3.org/2000/svg';
pdfjsDistBuildPdf.GlobalWorkerOptions.workerSrc =
pdfjsLib.GlobalWorkerOptions.workerSrc =
'../../node_modules/pdfjs-dist/build/pdf.worker.js';
function buildSVG(viewport, textContent) {
@ -33,8 +33,8 @@ function buildSVG(viewport, textContent) {
textContent.items.forEach(function (textItem) {
// we have to take in account viewport transform, which includes scale,
// rotation and Y-axis flip, and not forgetting to flip text.
var tx = pdfjsDistBuildPdf.Util.transform(
pdfjsDistBuildPdf.Util.transform(viewport.transform, textItem.transform),
var tx = pdfjsLib.Util.transform(
pdfjsLib.Util.transform(viewport.transform, textItem.transform),
[1, 0, 0, -1, 0, 0]);
var style = textContent.styles[textItem.fontName];
// adding text element
@ -49,7 +49,7 @@ function buildSVG(viewport, textContent) {
function pageLoaded() {
// Loading document and page text content
pdfjsDistBuildPdf.getDocument({url: PDF_PATH}).then(function (pdfDocument) {
pdfjsLib.getDocument({url: PDF_PATH}).then(function (pdfDocument) {
pdfDocument.getPage(PAGE_NUMBER).then(function (page) {
var viewport = page.getViewport(PAGE_SCALE);
page.getTextContent().then(function (textContent) {
@ -62,7 +62,7 @@ function pageLoaded() {
}
document.addEventListener('DOMContentLoaded', function () {
if (typeof pdfjsDistBuildPdf === 'undefined') {
if (typeof pdfjsLib === 'undefined') {
alert('Built version of PDF.js was not found.\n' +
'Please run `gulp dist-install`.');
return;