1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 17:48:07 +02:00

Replace *most* cases of var with let/const in the examples/ folder

These changes were done automatically, by using the `gulp lint --fix` command, in preparation for the next patch.
This commit is contained in:
Jonas Jenwald 2021-03-12 17:08:17 +01:00
parent 56fd01bf8d
commit 276fa4ad8f
15 changed files with 196 additions and 194 deletions

View file

@ -3,27 +3,27 @@
// Hello world example for browserify.
var pdfjsLib = require("pdfjs-dist");
const pdfjsLib = require("pdfjs-dist");
var pdfPath = "../learning/helloworld.pdf";
const pdfPath = "../learning/helloworld.pdf";
// Setting worker path to worker bundle.
pdfjsLib.GlobalWorkerOptions.workerSrc =
"../../build/browserify/pdf.worker.bundle.js";
// Loading a document.
var loadingTask = pdfjsLib.getDocument(pdfPath);
const loadingTask = pdfjsLib.getDocument(pdfPath);
loadingTask.promise
.then(function (pdfDocument) {
// Request a first page
return pdfDocument.getPage(1).then(function (pdfPage) {
// Display page on the existing canvas with 100% scale.
var viewport = pdfPage.getViewport({ scale: 1.0 });
var canvas = document.getElementById("theCanvas");
const viewport = pdfPage.getViewport({ scale: 1.0 });
const canvas = document.getElementById("theCanvas");
canvas.width = viewport.width;
canvas.height = viewport.height;
var ctx = canvas.getContext("2d");
var renderTask = pdfPage.render({
const ctx = canvas.getContext("2d");
const renderTask = pdfPage.render({
canvasContext: ctx,
viewport,
});