forked from mozilla/pdf.js
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from jlegewie/current
update to current pdf.js version
- Loading branch information
Showing
115 changed files
with
3,024 additions
and
1,352 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ Brendan Dahl <[email protected]> | |
Bill Walker <[email protected]> | ||
Chris G Jones <[email protected]> | ||
David Quintana <[email protected]> | ||
Felix Kälberer <@fkaelberer> | ||
Jakob Miland <[email protected]> | ||
Jonas Jenwald <[email protected]> | ||
Julian Viereck | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<!DOCTYPE html> | ||
<!-- | ||
Copyright 2014 Mozilla Foundation | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<html dir="ltr" mozdisallowselectionprint moznomarginboxes> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> | ||
<meta name="google" content="notranslate"> | ||
<title>PDF.js viewer using built components</title> | ||
|
||
<style> | ||
body { | ||
background-color: #808080; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
</style> | ||
|
||
<link rel="stylesheet" href="../../build/components/pdf_viewer.css"> | ||
|
||
<!-- for legacy browsers --> | ||
<script src="../../build/components/compatibility.js"></script> | ||
<script src="../../build/pdf.js"></script> | ||
<script src="../../build/components/pdf_viewer.js"></script> | ||
</head> | ||
|
||
<body tabindex="1"> | ||
<div id="viewerContainer"> | ||
<div id="viewer" class="pdfViewer"></div> | ||
</div> | ||
|
||
<script src="simpleviewer.js"></script> | ||
</body> | ||
</html> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* Copyright 2014 Mozilla Foundation | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
if (!PDFJS.PDFViewer || !PDFJS.getDocument) { | ||
alert('Please build the library and components using\n' + | ||
' `node make generic components`'); | ||
} | ||
|
||
// In cases when the pdf.worker.js is located at the different folder than the | ||
// pdf.js's one, or the pdf.js is executed via eval(), the workerSrc property | ||
// shall be specified. | ||
// | ||
// PDFJS.workerSrc = '../../build/pdf.worker.js'; | ||
|
||
// Some PDFs need external cmaps. | ||
// | ||
// PDFJS.cMapUrl = '../../external/bcmaps/'; | ||
// PDFJS.cMapPacked = true; | ||
|
||
var DEFAULT_URL = '../../web/compressed.tracemonkey-pldi-09.pdf'; | ||
|
||
var container = document.getElementById('viewerContainer'); | ||
var pdfViewer = new PDFJS.PDFViewer({ | ||
container: container | ||
}); | ||
|
||
container.addEventListener('pagesinit', function () { | ||
// we can use pdfViewer now, e.g. let's change default scale. | ||
pdfViewer.currentScaleValue = 'page-width'; | ||
}); | ||
|
||
// Loading document. | ||
PDFJS.getDocument(DEFAULT_URL).then(function (pdfDocument) { | ||
// Document loaded, specifying document for the viewer. | ||
pdfViewer.setDocument(pdfDocument); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,17 +26,42 @@ Cu.import('resource://gre/modules/Services.jsm'); | |
const ADDON_ID = "[email protected]"; | ||
|
||
var Telemetry = Services.telemetry; | ||
Telemetry.registerAddonHistogram(ADDON_ID, "PDF_VIEWER_USED", 1, 2, 3, Telemetry.HISTOGRAM_BOOLEAN); | ||
Telemetry.registerAddonHistogram(ADDON_ID, "PDF_VIEWER_FALLBACK_SHOWN", 1, 2, 3, Telemetry.HISTOGRAM_BOOLEAN); | ||
Telemetry.registerAddonHistogram(ADDON_ID, "PDF_VIEWER_DOCUMENT_VERSION", 1, 10, 11, Telemetry.HISTOGRAM_LINEAR); | ||
Telemetry.registerAddonHistogram(ADDON_ID, "PDF_VIEWER_DOCUMENT_GENERATOR", 1, 25, 26, Telemetry.HISTOGRAM_LINEAR); | ||
Telemetry.registerAddonHistogram(ADDON_ID, "PDF_VIEWER_DOCUMENT_SIZE_KB", 2, 64 * 1024, 20, Telemetry.HISTOGRAM_EXPONENTIAL); | ||
Telemetry.registerAddonHistogram(ADDON_ID, "PDF_VIEWER_EMBED", 1, 2, 3, Telemetry.HISTOGRAM_BOOLEAN); | ||
Telemetry.registerAddonHistogram(ADDON_ID, "PDF_VIEWER_FONT_TYPES", 1, 19, 20, Telemetry.HISTOGRAM_LINEAR); | ||
Telemetry.registerAddonHistogram(ADDON_ID, "PDF_VIEWER_FORM", 1, 2, 3, Telemetry.HISTOGRAM_BOOLEAN); | ||
Telemetry.registerAddonHistogram(ADDON_ID, "PDF_VIEWER_PRINT", 1, 2, 3, Telemetry.HISTOGRAM_BOOLEAN); | ||
Telemetry.registerAddonHistogram(ADDON_ID, "PDF_VIEWER_STREAM_TYPES", 1, 19, 20, Telemetry.HISTOGRAM_LINEAR); | ||
Telemetry.registerAddonHistogram(ADDON_ID, "PDF_VIEWER_TIME_TO_VIEW_MS", 1, 10000, 50, Telemetry.HISTOGRAM_EXPONENTIAL); | ||
|
||
var registerAddonHistogram = Telemetry.registerAddonHistogram; | ||
try { | ||
// Swapping arguments of the registerAddonHistogram for older Firefox versions. | ||
// See https://bugzilla.mozilla.org/show_bug.cgi?id=1069953. | ||
var ffVersion = parseInt(Services.appinfo.platformVersion); | ||
var oldTelemetryAPI = ffVersion < 36; | ||
if (ffVersion === 36) { | ||
// Probing FF36 to check if it has new API. | ||
try { | ||
Telemetry.registerAddonHistogram(ADDON_ID, "PDF_36", | ||
Telemetry.HISTOGRAM_LINEAR, 1, 40, 41); | ||
var histogram = Telemetry.getAddonHistogram(ADDON_ID, "PDF_36"); | ||
histogram.add(36); | ||
} catch (e) { | ||
oldTelemetryAPI = true; | ||
} | ||
} | ||
if (oldTelemetryAPI) { | ||
registerAddonHistogram = function (p1, p2, p3, p4, p5, p6) { | ||
return Telemetry.registerAddonHistogram(p1, p2, p4, p5, p6, p3); | ||
}; | ||
} | ||
} catch (ex) { } | ||
|
||
registerAddonHistogram(ADDON_ID, 'PDF_VIEWER_USED', Telemetry.HISTOGRAM_BOOLEAN, 1, 2, 3); | ||
registerAddonHistogram(ADDON_ID, 'PDF_VIEWER_FALLBACK_SHOWN', Telemetry.HISTOGRAM_BOOLEAN, 1, 2, 3); | ||
registerAddonHistogram(ADDON_ID, 'PDF_VIEWER_DOCUMENT_VERSION', Telemetry.HISTOGRAM_LINEAR, 1, 10, 11); | ||
registerAddonHistogram(ADDON_ID, 'PDF_VIEWER_DOCUMENT_GENERATOR', Telemetry.HISTOGRAM_LINEAR, 1, 25, 26); | ||
registerAddonHistogram(ADDON_ID, 'PDF_VIEWER_DOCUMENT_SIZE_KB', Telemetry.HISTOGRAM_EXPONENTIAL, 2, 64 * 1024, 20); | ||
registerAddonHistogram(ADDON_ID, 'PDF_VIEWER_EMBED', Telemetry.HISTOGRAM_BOOLEAN, 1, 2, 3); | ||
registerAddonHistogram(ADDON_ID, 'PDF_VIEWER_FONT_TYPES', Telemetry.HISTOGRAM_LINEAR, 1, 19, 20); | ||
registerAddonHistogram(ADDON_ID, 'PDF_VIEWER_FORM', Telemetry.HISTOGRAM_BOOLEAN, 1, 2, 3); | ||
registerAddonHistogram(ADDON_ID, 'PDF_VIEWER_PRINT', Telemetry.HISTOGRAM_BOOLEAN, 1, 2, 3); | ||
registerAddonHistogram(ADDON_ID, 'PDF_VIEWER_STREAM_TYPES', Telemetry.HISTOGRAM_LINEAR, 1, 19, 20); | ||
registerAddonHistogram(ADDON_ID, 'PDF_VIEWER_TIME_TO_VIEW_MS', Telemetry.HISTOGRAM_EXPONENTIAL, 1, 10000, 50); | ||
|
||
|
||
this.PdfJsTelemetry = { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.