Merge remote branch 'upstream/master'
This commit is contained in:
commit
fdf4db3365
Binary file not shown.
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 3.8 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
BIN
images/source/FileButton.psd.zip
Normal file
BIN
images/source/FileButton.psd.zip
Normal file
Binary file not shown.
@ -27,7 +27,30 @@ span {
|
|||||||
|
|
||||||
.control > input {
|
.control > input {
|
||||||
float: left;
|
float: left;
|
||||||
|
border: 1px solid #4d4d4d;
|
||||||
|
height: 20px;
|
||||||
|
padding: 0px;
|
||||||
margin: 0px 2px 0px 0px;
|
margin: 0px 2px 0px 0px;
|
||||||
|
border-radius: 4px;
|
||||||
|
-moz-border-radius: 4px;
|
||||||
|
-webkit-border-radius: 4px;
|
||||||
|
box-shadow: 0px 1px 0px rgba(255, 255, 255, 0.25);
|
||||||
|
-moz-box-shadow: 0px 1px 0px rgba(255, 255, 255, 0.25);
|
||||||
|
-webkit-box-shadow: 0px 1px 0px rgba(255, 255, 255, 0.25);
|
||||||
|
}
|
||||||
|
|
||||||
|
.control > select {
|
||||||
|
float: left;
|
||||||
|
border: 1px solid #4d4d4d;
|
||||||
|
height: 22px;
|
||||||
|
padding: 2px 0px 0px;
|
||||||
|
margin: 0px 0px 1px;
|
||||||
|
border-radius: 4px;
|
||||||
|
-moz-border-radius: 4px;
|
||||||
|
-webkit-border-radius: 4px;
|
||||||
|
box-shadow: 0px 1px 0px rgba(255, 255, 255, 0.25);
|
||||||
|
-moz-box-shadow: 0px 1px 0px rgba(255, 255, 255, 0.25);
|
||||||
|
-webkit-box-shadow: 0px 1px 0px rgba(255, 255, 255, 0.25);
|
||||||
}
|
}
|
||||||
|
|
||||||
.control > span {
|
.control > span {
|
||||||
@ -61,7 +84,7 @@ span {
|
|||||||
background-color: #eee;
|
background-color: #eee;
|
||||||
border-bottom: 1px solid #666;
|
border-bottom: 1px solid #666;
|
||||||
padding: 4px 0px 0px 8px;
|
padding: 4px 0px 0px 8px;
|
||||||
position:fixed;
|
position: fixed;
|
||||||
left: 0px;
|
left: 0px;
|
||||||
top: 0px;
|
top: 0px;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
@ -79,7 +102,7 @@ span {
|
|||||||
|
|
||||||
#previousPageButton {
|
#previousPageButton {
|
||||||
background: url('images/buttons.png') no-repeat 0px -23px;
|
background: url('images/buttons.png') no-repeat 0px -23px;
|
||||||
cursor: pointer;
|
cursor: default;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
float: left;
|
float: left;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
@ -97,7 +120,7 @@ span {
|
|||||||
|
|
||||||
#nextPageButton {
|
#nextPageButton {
|
||||||
background: url('images/buttons.png') no-repeat -28px -23px;
|
background: url('images/buttons.png') no-repeat -28px -23px;
|
||||||
cursor: pointer;
|
cursor: default;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
float: left;
|
float: left;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
@ -113,71 +136,61 @@ span {
|
|||||||
background: url('images/buttons.png') no-repeat -28px 0px;
|
background: url('images/buttons.png') no-repeat -28px 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#scaleComboBoxInput {
|
#openFileButton {
|
||||||
background: url('images/combobox.png') no-repeat 0px -23px;
|
background: url('images/buttons.png') no-repeat -56px -23px;
|
||||||
|
cursor: default;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
float: left;
|
float: left;
|
||||||
margin: 0px;
|
margin: 0px 0px 0px 3px;
|
||||||
width: 35px;
|
width: 29px;
|
||||||
height: 23px;
|
height: 23px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#scaleComboBoxInput input {
|
#openFileButton.down {
|
||||||
background: none;
|
background: url('images/buttons.png') no-repeat -56px -46px;
|
||||||
border: 0px;
|
|
||||||
margin: 3px 2px 0px;
|
|
||||||
width: 31px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#scaleComboBoxButton {
|
#openFileButton.disabled {
|
||||||
background: url('images/combobox.png') no-repeat -41px -23px;
|
background: url('images/buttons.png') no-repeat -56px 0px;
|
||||||
cursor: pointer;
|
|
||||||
display: inline-block;
|
|
||||||
float: left;
|
|
||||||
margin: 0px;
|
|
||||||
width: 21px;
|
|
||||||
height: 23px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#scaleComboBoxButton.down {
|
#fileInput {
|
||||||
background: url('images/combobox.png') no-repeat -41px -46px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#scaleComboBoxButton.disabled {
|
|
||||||
background: url('images/combobox.png') no-repeat -41px 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#scaleComboBoxList {
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #666;
|
|
||||||
clear: both;
|
|
||||||
position: relative;
|
|
||||||
display: none;
|
display: none;
|
||||||
top: -20px;
|
|
||||||
width: 48px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#scaleComboBoxList > ul {
|
#pageNumber {
|
||||||
list-style: none;
|
|
||||||
padding: 0px;
|
|
||||||
margin: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#scaleComboBoxList > ul > li {
|
|
||||||
display: inline-block;
|
|
||||||
cursor: pointer;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
#scaleComboBoxList > ul > li:hover {
|
|
||||||
background-color: #09f;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
#pageNumber, #scale {
|
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#sidebar {
|
||||||
|
background-color: rgba(0, 0, 0, 0.8);
|
||||||
|
position: fixed;
|
||||||
|
width: 150px;
|
||||||
|
top: 62px;
|
||||||
|
bottom: 18px;
|
||||||
|
border-top-right-radius: 8px;
|
||||||
|
border-bottom-right-radius: 8px;
|
||||||
|
-moz-border-radius-topright: 8px;
|
||||||
|
-moz-border-radius-bottomright: 8px;
|
||||||
|
-webkit-border-top-right-radius: 8px;
|
||||||
|
-webkit-border-bottom-right-radius: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#sidebarScrollView {
|
||||||
|
position: absolute;
|
||||||
|
overflow: hidden;
|
||||||
|
overflow-y: auto;
|
||||||
|
top: 40px;
|
||||||
|
right: 10px;
|
||||||
|
bottom: 10px;
|
||||||
|
left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#sidebarContentView {
|
||||||
|
height: auto;
|
||||||
|
width: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
#viewer {
|
#viewer {
|
||||||
margin: 44px 0px 0px;
|
margin: 44px 0px 0px;
|
||||||
padding: 8px 0px;
|
padding: 8px 0px;
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>pdf.js Multi-Page Viewer</title>
|
<title>pdf.js Multi-Page Viewer</title>
|
||||||
<link rel="stylesheet" href="multi-page-viewer.css" type="text/css" media="screen" charset="utf-8"/>
|
<meta http-equiv="Content-type" content="text/html;charset=UTF-8"/>
|
||||||
|
<link rel="stylesheet" href="multi-page-viewer.css" type="text/css" media="screen"/>
|
||||||
<script type="text/javascript" src="pdf.js"></script>
|
<script type="text/javascript" src="pdf.js"></script>
|
||||||
<script type="text/javascript" src="fonts.js"></script>
|
<script type="text/javascript" src="fonts.js"></script>
|
||||||
<script type="text/javascript" src="glyphlist.js"></script>
|
<script type="text/javascript" src="glyphlist.js"></script>
|
||||||
@ -11,7 +12,8 @@
|
|||||||
<body>
|
<body>
|
||||||
<div id="controls">
|
<div id="controls">
|
||||||
<span class="control">
|
<span class="control">
|
||||||
<span id="previousPageButton"></span><span id="nextPageButton"></span>
|
<span id="previousPageButton" class="disabled"></span>
|
||||||
|
<span id="nextPageButton" class="disabled"></span>
|
||||||
<span class="label">Previous/Next</span>
|
<span class="label">Previous/Next</span>
|
||||||
</span>
|
</span>
|
||||||
<span class="control">
|
<span class="control">
|
||||||
@ -21,20 +23,29 @@
|
|||||||
<span class="label">Page Number</span>
|
<span class="label">Page Number</span>
|
||||||
</span>
|
</span>
|
||||||
<span class="control">
|
<span class="control">
|
||||||
<span id="scaleComboBoxInput"><input type="text" id="scale" value="100%" size="2"/></span><span id="scaleComboBoxButton"></span>
|
<select id="scaleSelect">
|
||||||
|
<option value="50">50%</option>
|
||||||
|
<option value="75">75%</option>
|
||||||
|
<option value="100" selected="selected">100%</option>
|
||||||
|
<option value="125">125%</option>
|
||||||
|
<option value="150">150%</option>
|
||||||
|
<option value="200">200%</option>
|
||||||
|
</select>
|
||||||
<span class="label">Zoom</span>
|
<span class="label">Zoom</span>
|
||||||
<div id="scaleComboBoxList">
|
</span>
|
||||||
<ul>
|
<span class="control">
|
||||||
<li>50%</li>
|
<span id="openFileButton"></span>
|
||||||
<li>75%</li>
|
<input type="file" id="fileInput"/>
|
||||||
<li>100%</li>
|
<span class="label">Open File</span>
|
||||||
<li>125%</li>
|
|
||||||
<li>150%</li>
|
|
||||||
<li>200%</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
<!--<div id="sidebar">
|
||||||
|
<div id="sidebarScrollView">
|
||||||
|
<div id="sidebarContentView">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>-->
|
||||||
<div id="viewer"></div>
|
<div id="viewer"></div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -11,7 +11,8 @@ var PDFViewer = {
|
|||||||
previousPageButton: null,
|
previousPageButton: null,
|
||||||
nextPageButton: null,
|
nextPageButton: null,
|
||||||
pageNumberInput: null,
|
pageNumberInput: null,
|
||||||
scaleInput: null,
|
scaleSelect: null,
|
||||||
|
fileInput: null,
|
||||||
|
|
||||||
willJumpToPage: false,
|
willJumpToPage: false,
|
||||||
|
|
||||||
@ -66,92 +67,103 @@ var PDFViewer = {
|
|||||||
removePage: function(num) {
|
removePage: function(num) {
|
||||||
var div = document.getElementById('pageContainer' + num);
|
var div = document.getElementById('pageContainer' + num);
|
||||||
|
|
||||||
if (div && div.hasChildNodes()) {
|
if (div) {
|
||||||
while (div.childNodes.length > 0) {
|
while (div.hasChildNodes()) {
|
||||||
div.removeChild(div.firstChild);
|
div.removeChild(div.firstChild);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
drawPage: function(num) {
|
drawPage: function(num) {
|
||||||
if (PDFViewer.pdf) {
|
if (!PDFViewer.pdf) {
|
||||||
var page = PDFViewer.pdf.getPage(num);
|
return;
|
||||||
var div = document.getElementById('pageContainer' + num);
|
}
|
||||||
|
|
||||||
if (div && !div.hasChildNodes()) {
|
|
||||||
var canvas = document.createElement('canvas');
|
|
||||||
canvas.id = 'page' + num;
|
|
||||||
canvas.mozOpaque = true;
|
|
||||||
|
|
||||||
// Canvas dimensions must be specified in CSS pixels. CSS pixels
|
|
||||||
// are always 96 dpi. These dimensions are 8.5in x 11in at 96dpi.
|
|
||||||
canvas.width = PDFViewer.pageWidth();
|
|
||||||
canvas.height = PDFViewer.pageHeight();
|
|
||||||
|
|
||||||
var ctx = canvas.getContext('2d');
|
|
||||||
ctx.save();
|
|
||||||
ctx.fillStyle = 'rgb(255, 255, 255)';
|
|
||||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
||||||
ctx.restore();
|
|
||||||
|
|
||||||
var gfx = new CanvasGraphics(ctx);
|
|
||||||
var fonts = [];
|
|
||||||
|
|
||||||
// page.compile will collect all fonts for us, once we have loaded them
|
var div = document.getElementById('pageContainer' + num);
|
||||||
// we can trigger the actual page rendering with page.display
|
var canvas = document.createElement('canvas');
|
||||||
page.compile(gfx, fonts);
|
|
||||||
|
if (div && !div.hasChildNodes()) {
|
||||||
var fontsReady = true;
|
div.appendChild(canvas);
|
||||||
|
|
||||||
// Inspect fonts and translate the missing one
|
var page = PDFViewer.pdf.getPage(num);
|
||||||
var fontCount = fonts.length;
|
|
||||||
|
|
||||||
for (var i = 0; i < fontCount; i++) {
|
|
||||||
var font = fonts[i];
|
|
||||||
|
|
||||||
if (Fonts[font.name]) {
|
|
||||||
fontsReady = fontsReady && !Fonts[font.name].loading;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
new Font(font.name, font.file, font.properties);
|
canvas.id = 'page' + num;
|
||||||
|
canvas.mozOpaque = true;
|
||||||
fontsReady = false;
|
|
||||||
|
// Canvas dimensions must be specified in CSS pixels. CSS pixels
|
||||||
|
// are always 96 dpi. These dimensions are 8.5in x 11in at 96dpi.
|
||||||
|
canvas.width = PDFViewer.pageWidth();
|
||||||
|
canvas.height = PDFViewer.pageHeight();
|
||||||
|
|
||||||
|
var ctx = canvas.getContext('2d');
|
||||||
|
ctx.save();
|
||||||
|
ctx.fillStyle = 'rgb(255, 255, 255)';
|
||||||
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||||
|
ctx.restore();
|
||||||
|
|
||||||
|
var gfx = new CanvasGraphics(ctx);
|
||||||
|
var fonts = [];
|
||||||
|
|
||||||
|
// page.compile will collect all fonts for us, once we have loaded them
|
||||||
|
// we can trigger the actual page rendering with page.display
|
||||||
|
page.compile(gfx, fonts);
|
||||||
|
|
||||||
|
var areFontsReady = true;
|
||||||
|
|
||||||
|
// Inspect fonts and translate the missing one
|
||||||
|
var fontCount = fonts.length;
|
||||||
|
|
||||||
|
for (var i = 0; i < fontCount; i++) {
|
||||||
|
var font = fonts[i];
|
||||||
|
|
||||||
|
if (Fonts[font.name]) {
|
||||||
|
areFontsReady = areFontsReady && !Fonts[font.name].loading;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var pageInterval;
|
new Font(font.name, font.file, font.properties);
|
||||||
var delayLoadFont = function() {
|
|
||||||
for (var i = 0; i < fontCount; i++) {
|
areFontsReady = false;
|
||||||
if (Fonts[font.name].loading) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
clearInterval(pageInterval);
|
|
||||||
|
|
||||||
PDFViewer.drawPage(num);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fontsReady) {
|
|
||||||
pageInterval = setInterval(delayLoadFont, 10);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
page.display(gfx);
|
|
||||||
div.appendChild(canvas);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var pageInterval;
|
||||||
|
|
||||||
|
var delayLoadFont = function() {
|
||||||
|
for (var i = 0; i < fontCount; i++) {
|
||||||
|
if (Fonts[font.name].loading) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
clearInterval(pageInterval);
|
||||||
|
|
||||||
|
while (div.hasChildNodes()) {
|
||||||
|
div.removeChild(div.firstChild);
|
||||||
|
}
|
||||||
|
|
||||||
|
PDFViewer.drawPage(num);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!areFontsReady) {
|
||||||
|
pageInterval = setInterval(delayLoadFont, 10);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
page.display(gfx);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
changeScale: function(num) {
|
changeScale: function(num) {
|
||||||
while (PDFViewer.element.childNodes.length > 0) {
|
while (PDFViewer.element.hasChildNodes()) {
|
||||||
PDFViewer.element.removeChild(PDFViewer.element.firstChild);
|
PDFViewer.element.removeChild(PDFViewer.element.firstChild);
|
||||||
}
|
}
|
||||||
|
|
||||||
PDFViewer.scale = num / 100;
|
PDFViewer.scale = num / 100;
|
||||||
|
|
||||||
|
var i;
|
||||||
|
|
||||||
if (PDFViewer.pdf) {
|
if (PDFViewer.pdf) {
|
||||||
for (var i = 1; i <= PDFViewer.numberOfPages; i++) {
|
for (i = 1; i <= PDFViewer.numberOfPages; i++) {
|
||||||
PDFViewer.createPage(i);
|
PDFViewer.createPage(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,7 +172,21 @@ var PDFViewer = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PDFViewer.scaleInput.value = Math.floor(PDFViewer.scale * 100) + '%';
|
for (i = 0; i < PDFViewer.scaleSelect.childNodes; i++) {
|
||||||
|
var option = PDFViewer.scaleSelect.childNodes[i];
|
||||||
|
|
||||||
|
if (option.value == num) {
|
||||||
|
if (!option.selected) {
|
||||||
|
option.selected = 'selected';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (option.selected) {
|
||||||
|
option.removeAttribute('selected');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PDFViewer.scaleSelect.value = Math.floor(PDFViewer.scale * 100) + '%';
|
||||||
},
|
},
|
||||||
|
|
||||||
goToPage: function(num) {
|
goToPage: function(num) {
|
||||||
@ -190,7 +216,7 @@ var PDFViewer = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
open: function(url) {
|
openURL: function(url) {
|
||||||
PDFViewer.url = url;
|
PDFViewer.url = url;
|
||||||
document.title = url;
|
document.title = url;
|
||||||
|
|
||||||
@ -206,21 +232,35 @@ var PDFViewer = {
|
|||||||
req.responseArrayBuffer ||
|
req.responseArrayBuffer ||
|
||||||
req.response;
|
req.response;
|
||||||
|
|
||||||
PDFViewer.pdf = new PDFDoc(new Stream(data));
|
PDFViewer.readPDF(data);
|
||||||
PDFViewer.numberOfPages = PDFViewer.pdf.numPages;
|
|
||||||
document.getElementById('numPages').innerHTML = PDFViewer.numberOfPages.toString();
|
|
||||||
|
|
||||||
for (var i = 1; i <= PDFViewer.numberOfPages; i++) {
|
|
||||||
PDFViewer.createPage(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PDFViewer.numberOfPages > 0) {
|
|
||||||
PDFViewer.drawPage(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
req.send(null);
|
req.send(null);
|
||||||
|
},
|
||||||
|
|
||||||
|
readPDF: function(data) {
|
||||||
|
while (PDFViewer.element.hasChildNodes()) {
|
||||||
|
PDFViewer.element.removeChild(PDFViewer.element.firstChild);
|
||||||
|
}
|
||||||
|
|
||||||
|
PDFViewer.pdf = new PDFDoc(new Stream(data));
|
||||||
|
PDFViewer.numberOfPages = PDFViewer.pdf.numPages;
|
||||||
|
document.getElementById('numPages').innerHTML = PDFViewer.numberOfPages.toString();
|
||||||
|
|
||||||
|
for (var i = 1; i <= PDFViewer.numberOfPages; i++) {
|
||||||
|
PDFViewer.createPage(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PDFViewer.numberOfPages > 0) {
|
||||||
|
PDFViewer.drawPage(1);
|
||||||
|
document.location.hash = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
PDFViewer.previousPageButton.className = (PDFViewer.pageNumber === 1) ?
|
||||||
|
'disabled' : '';
|
||||||
|
PDFViewer.nextPageButton.className = (PDFViewer.pageNumber === PDFViewer.numberOfPages) ?
|
||||||
|
'disabled' : '';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -320,41 +360,67 @@ window.onload = function() {
|
|||||||
this.className = (this.className.indexOf('disabled') !== -1) ? 'disabled' : '';
|
this.className = (this.className.indexOf('disabled') !== -1) ? 'disabled' : '';
|
||||||
};
|
};
|
||||||
|
|
||||||
PDFViewer.scaleInput = document.getElementById('scale');
|
PDFViewer.scaleSelect = document.getElementById('scaleSelect');
|
||||||
PDFViewer.scaleInput.buttonElement = document.getElementById('scaleComboBoxButton');
|
PDFViewer.scaleSelect.onchange = function(evt) {
|
||||||
PDFViewer.scaleInput.buttonElement.listElement = document.getElementById('scaleComboBoxList');
|
|
||||||
PDFViewer.scaleInput.onchange = function(evt) {
|
|
||||||
PDFViewer.changeScale(parseInt(this.value));
|
PDFViewer.changeScale(parseInt(this.value));
|
||||||
};
|
};
|
||||||
|
|
||||||
PDFViewer.scaleInput.buttonElement.onclick = function(evt) {
|
|
||||||
this.listElement.style.display = (this.listElement.style.display === 'block') ? 'none' : 'block';
|
|
||||||
};
|
|
||||||
PDFViewer.scaleInput.buttonElement.onmousedown = function(evt) {
|
|
||||||
if (this.className.indexOf('disabled') === -1) {
|
|
||||||
this.className = 'down';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
PDFViewer.scaleInput.buttonElement.onmouseup = function(evt) {
|
|
||||||
this.className = (this.className.indexOf('disabled') !== -1) ? 'disabled' : '';
|
|
||||||
};
|
|
||||||
PDFViewer.scaleInput.buttonElement.onmouseout = function(evt) {
|
|
||||||
this.className = (this.className.indexOf('disabled') !== -1) ? 'disabled' : '';
|
|
||||||
};
|
|
||||||
|
|
||||||
var listItems = PDFViewer.scaleInput.buttonElement.listElement.getElementsByTagName('LI');
|
if (window.File && window.FileReader && window.FileList && window.Blob) {
|
||||||
|
var openFileButton = document.getElementById('openFileButton');
|
||||||
for (var i = 0; i < listItems.length; i++) {
|
openFileButton.onclick = function(evt) {
|
||||||
var listItem = listItems[i];
|
if (this.className.indexOf('disabled') === -1) {
|
||||||
listItem.onclick = function(evt) {
|
PDFViewer.fileInput.click();
|
||||||
PDFViewer.changeScale(parseInt(this.innerHTML));
|
}
|
||||||
PDFViewer.scaleInput.buttonElement.listElement.style.display = 'none';
|
|
||||||
};
|
};
|
||||||
|
openFileButton.onmousedown = function(evt) {
|
||||||
|
if (this.className.indexOf('disabled') === -1) {
|
||||||
|
this.className = 'down';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
openFileButton.onmouseup = function(evt) {
|
||||||
|
this.className = (this.className.indexOf('disabled') !== -1) ? 'disabled' : '';
|
||||||
|
};
|
||||||
|
openFileButton.onmouseout = function(evt) {
|
||||||
|
this.className = (this.className.indexOf('disabled') !== -1) ? 'disabled' : '';
|
||||||
|
};
|
||||||
|
|
||||||
|
PDFViewer.fileInput = document.getElementById('fileInput');
|
||||||
|
PDFViewer.fileInput.onchange = function(evt) {
|
||||||
|
var files = evt.target.files;
|
||||||
|
|
||||||
|
if (files.length > 0) {
|
||||||
|
var file = files[0];
|
||||||
|
var fileReader = new FileReader();
|
||||||
|
|
||||||
|
document.title = file.name;
|
||||||
|
|
||||||
|
// Read the local file into a Uint8Array.
|
||||||
|
fileReader.onload = function(evt) {
|
||||||
|
var data = evt.target.result;
|
||||||
|
var buffer = new ArrayBuffer(data.length);
|
||||||
|
var uint8Array = new Uint8Array(buffer);
|
||||||
|
|
||||||
|
for (var i = 0; i < data.length; i++) {
|
||||||
|
uint8Array[i] = data.charCodeAt(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
PDFViewer.readPDF(uint8Array);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Read as a binary string since "readAsArrayBuffer" is not yet
|
||||||
|
// implemented in Firefox.
|
||||||
|
fileReader.readAsBinaryString(file);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
PDFViewer.fileInput.value = null;
|
||||||
|
} else {
|
||||||
|
document.getElementById('fileWrapper').style.display = 'none';
|
||||||
}
|
}
|
||||||
|
|
||||||
PDFViewer.pageNumber = parseInt(PDFViewer.queryParams.page) || PDFViewer.pageNumber;
|
PDFViewer.pageNumber = parseInt(PDFViewer.queryParams.page) || PDFViewer.pageNumber;
|
||||||
PDFViewer.scale = parseInt(PDFViewer.scaleInput.value) / 100 || 1.0;
|
PDFViewer.scale = parseInt(PDFViewer.scaleSelect.value) / 100 || 1.0;
|
||||||
PDFViewer.open(PDFViewer.queryParams.file || PDFViewer.url);
|
|
||||||
|
PDFViewer.openURL(PDFViewer.queryParams.file || PDFViewer.url);
|
||||||
|
|
||||||
window.onscroll = function(evt) {
|
window.onscroll = function(evt) {
|
||||||
var lastPagesDrawn = PDFViewer.lastPagesDrawn;
|
var lastPagesDrawn = PDFViewer.lastPagesDrawn;
|
||||||
|
169
test.py
169
test.py
@ -1,7 +1,16 @@
|
|||||||
import json, os, sys, subprocess
|
import json, os, sys, subprocess, urllib2
|
||||||
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
|
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
|
||||||
|
from urlparse import urlparse
|
||||||
|
|
||||||
|
def prompt(question):
|
||||||
|
'''Return True iff the user answered "yes" to |question|.'''
|
||||||
|
inp = raw_input(question +' [yes/no] > ')
|
||||||
|
return inp == 'yes'
|
||||||
|
|
||||||
ANAL = True
|
ANAL = True
|
||||||
|
DEFAULT_MANIFEST_FILE = 'test_manifest.json'
|
||||||
|
REFDIR = 'ref'
|
||||||
|
TMPDIR = 'tmp'
|
||||||
VERBOSE = False
|
VERBOSE = False
|
||||||
|
|
||||||
MIMEs = {
|
MIMEs = {
|
||||||
@ -20,6 +29,12 @@ class State:
|
|||||||
remaining = 0
|
remaining = 0
|
||||||
results = { }
|
results = { }
|
||||||
done = False
|
done = False
|
||||||
|
masterMode = False
|
||||||
|
numErrors = 0
|
||||||
|
numEqFailures = 0
|
||||||
|
numEqNoSnapshot = 0
|
||||||
|
numFBFFailures = 0
|
||||||
|
numLoadFailures = 0
|
||||||
|
|
||||||
class Result:
|
class Result:
|
||||||
def __init__(self, snapshot, failure):
|
def __init__(self, snapshot, failure):
|
||||||
@ -34,8 +49,11 @@ class PDFTestHandler(BaseHTTPRequestHandler):
|
|||||||
BaseHTTPRequestHandler.log_request(code, size)
|
BaseHTTPRequestHandler.log_request(code, size)
|
||||||
|
|
||||||
def do_GET(self):
|
def do_GET(self):
|
||||||
|
url = urlparse(self.path)
|
||||||
|
# Ignore query string
|
||||||
|
path, _ = url.path, url.query
|
||||||
cwd = os.getcwd()
|
cwd = os.getcwd()
|
||||||
path = os.path.abspath(os.path.realpath(cwd + os.sep + self.path))
|
path = os.path.abspath(os.path.realpath(cwd + os.sep + path))
|
||||||
cwd = os.path.abspath(cwd)
|
cwd = os.path.abspath(cwd)
|
||||||
prefix = os.path.commonprefix(( path, cwd ))
|
prefix = os.path.commonprefix(( path, cwd ))
|
||||||
_, ext = os.path.splitext(path)
|
_, ext = os.path.splitext(path)
|
||||||
@ -69,31 +87,59 @@ class PDFTestHandler(BaseHTTPRequestHandler):
|
|||||||
self.end_headers()
|
self.end_headers()
|
||||||
|
|
||||||
result = json.loads(self.rfile.read(numBytes))
|
result = json.loads(self.rfile.read(numBytes))
|
||||||
browser = 'firefox4'
|
browser, id, failure, round, page, snapshot = result['browser'], result['id'], result['failure'], result['round'], result['page'], result['snapshot']
|
||||||
id, failure, round, page, snapshot = result['id'], result['failure'], result['round'], result['page'], result['snapshot']
|
|
||||||
taskResults = State.taskResults[browser][id]
|
taskResults = State.taskResults[browser][id]
|
||||||
taskResults[round][page - 1] = Result(snapshot, failure)
|
taskResults[round].append(Result(snapshot, failure))
|
||||||
|
assert len(taskResults[round]) == page
|
||||||
|
|
||||||
if result['taskDone']:
|
if result['taskDone']:
|
||||||
check(State.manifest[id], taskResults, browser)
|
check(State.manifest[id], taskResults, browser)
|
||||||
|
# Please oh please GC this ...
|
||||||
|
del State.taskResults[browser][id]
|
||||||
State.remaining -= 1
|
State.remaining -= 1
|
||||||
|
|
||||||
State.done = (0 == State.remaining)
|
State.done = (0 == State.remaining)
|
||||||
|
|
||||||
|
|
||||||
def set_up():
|
|
||||||
|
def setUp(manifestFile, masterMode):
|
||||||
# Only serve files from a pdf.js clone
|
# Only serve files from a pdf.js clone
|
||||||
assert not ANAL or os.path.isfile('pdf.js') and os.path.isdir('.git')
|
assert not ANAL or os.path.isfile('pdf.js') and os.path.isdir('.git')
|
||||||
|
|
||||||
|
State.masterMode = masterMode
|
||||||
|
if masterMode and os.path.isdir(TMPDIR):
|
||||||
|
print 'Temporary snapshot dir tmp/ is still around.'
|
||||||
|
print 'tmp/ can be removed if it has nothing you need.'
|
||||||
|
if prompt('SHOULD THIS SCRIPT REMOVE tmp/? THINK CAREFULLY'):
|
||||||
|
subprocess.call(( 'rm', '-rf', 'tmp' ))
|
||||||
|
|
||||||
|
assert not os.path.isdir(TMPDIR)
|
||||||
|
|
||||||
testBrowsers = [ b for b in
|
testBrowsers = [ b for b in
|
||||||
( 'firefox4', )
|
( 'firefox5', )
|
||||||
#'chrome12', 'chrome13', 'firefox5', 'firefox6','opera11' ):
|
#'chrome12', 'chrome13', 'firefox4', 'firefox6','opera11' ):
|
||||||
if os.access(b, os.R_OK | os.X_OK) ]
|
if os.access(b, os.R_OK | os.X_OK) ]
|
||||||
|
|
||||||
mf = open('test_manifest.json')
|
mf = open(manifestFile)
|
||||||
manifestList = json.load(mf)
|
manifestList = json.load(mf)
|
||||||
mf.close()
|
mf.close()
|
||||||
|
|
||||||
|
for item in manifestList:
|
||||||
|
f, isLink = item['file'], item.get('link', False)
|
||||||
|
if isLink and not os.access(f, os.R_OK):
|
||||||
|
linkFile = open(f +'.link')
|
||||||
|
link = linkFile.read()
|
||||||
|
linkFile.close()
|
||||||
|
|
||||||
|
sys.stdout.write('Downloading '+ link +' to '+ f +' ...')
|
||||||
|
sys.stdout.flush()
|
||||||
|
response = urllib2.urlopen(link)
|
||||||
|
|
||||||
|
out = open(f, 'w')
|
||||||
|
out.write(response.read())
|
||||||
|
out.close()
|
||||||
|
|
||||||
|
print 'done'
|
||||||
|
|
||||||
for b in testBrowsers:
|
for b in testBrowsers:
|
||||||
State.taskResults[b] = { }
|
State.taskResults[b] = { }
|
||||||
for item in manifestList:
|
for item in manifestList:
|
||||||
@ -101,15 +147,16 @@ def set_up():
|
|||||||
State.manifest[id] = item
|
State.manifest[id] = item
|
||||||
taskResults = [ ]
|
taskResults = [ ]
|
||||||
for r in xrange(rounds):
|
for r in xrange(rounds):
|
||||||
taskResults.append([ None ] * 100)
|
taskResults.append([ ])
|
||||||
State.taskResults[b][id] = taskResults
|
State.taskResults[b][id] = taskResults
|
||||||
|
|
||||||
State.remaining = len(manifestList)
|
State.remaining = len(manifestList)
|
||||||
|
|
||||||
for b in testBrowsers:
|
for b in testBrowsers:
|
||||||
print 'Launching', b
|
print 'Launching', b
|
||||||
|
qs = 'browser='+ b +'&manifestFile='+ manifestFile
|
||||||
subprocess.Popen(( os.path.abspath(os.path.realpath(b)),
|
subprocess.Popen(( os.path.abspath(os.path.realpath(b)),
|
||||||
'http://localhost:8080/test_slave.html' ))
|
'http://localhost:8080/test_slave.html?'+ qs))
|
||||||
|
|
||||||
|
|
||||||
def check(task, results, browser):
|
def check(task, results, browser):
|
||||||
@ -123,13 +170,14 @@ def check(task, results, browser):
|
|||||||
failure = pageResult.failure
|
failure = pageResult.failure
|
||||||
if failure:
|
if failure:
|
||||||
failed = True
|
failed = True
|
||||||
|
State.numErrors += 1
|
||||||
print 'TEST-UNEXPECTED-FAIL | test failed', task['id'], '| in', browser, '| page', p + 1, 'round', r, '|', failure
|
print 'TEST-UNEXPECTED-FAIL | test failed', task['id'], '| in', browser, '| page', p + 1, 'round', r, '|', failure
|
||||||
|
|
||||||
if failed:
|
if failed:
|
||||||
return
|
return
|
||||||
|
|
||||||
kind = task['type']
|
kind = task['type']
|
||||||
if '==' == kind:
|
if 'eq' == kind:
|
||||||
checkEq(task, results, browser)
|
checkEq(task, results, browser)
|
||||||
elif 'fbf' == kind:
|
elif 'fbf' == kind:
|
||||||
checkFBF(task, results, browser)
|
checkFBF(task, results, browser)
|
||||||
@ -140,23 +188,60 @@ def check(task, results, browser):
|
|||||||
|
|
||||||
|
|
||||||
def checkEq(task, results, browser):
|
def checkEq(task, results, browser):
|
||||||
print ' !!! [TODO: == tests] !!!'
|
pfx = os.path.join(REFDIR, sys.platform, browser, task['id'])
|
||||||
print 'TEST-PASS | == test', task['id'], '| in', browser
|
results = results[0]
|
||||||
|
|
||||||
|
passed = True
|
||||||
|
for page in xrange(len(results)):
|
||||||
|
snapshot = results[page].snapshot
|
||||||
|
ref = None
|
||||||
|
eq = True
|
||||||
|
|
||||||
|
path = os.path.join(pfx, str(page + 1))
|
||||||
|
if not os.access(path, os.R_OK):
|
||||||
|
print 'WARNING: no reference snapshot', path
|
||||||
|
State.numEqNoSnapshot += 1
|
||||||
|
else:
|
||||||
|
f = open(path)
|
||||||
|
ref = f.read()
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
eq = (ref == snapshot)
|
||||||
|
if not eq:
|
||||||
|
print 'TEST-UNEXPECTED-FAIL | eq', task['id'], '| in', browser, '| rendering of page', page + 1, '!= reference rendering'
|
||||||
|
passed = False
|
||||||
|
State.numEqFailures += 1
|
||||||
|
|
||||||
|
if State.masterMode and (ref is None or not eq):
|
||||||
|
tmpTaskDir = os.path.join(TMPDIR, sys.platform, browser, task['id'])
|
||||||
|
try:
|
||||||
|
os.makedirs(tmpTaskDir)
|
||||||
|
except OSError, e:
|
||||||
|
pass
|
||||||
|
|
||||||
|
of = open(os.path.join(tmpTaskDir, str(page + 1)), 'w')
|
||||||
|
of.write(snapshot)
|
||||||
|
of.close()
|
||||||
|
|
||||||
|
if passed:
|
||||||
|
print 'TEST-PASS | eq test', task['id'], '| in', browser
|
||||||
|
|
||||||
printed = [False]
|
|
||||||
|
|
||||||
def checkFBF(task, results, browser):
|
def checkFBF(task, results, browser):
|
||||||
round0, round1 = results[0], results[1]
|
round0, round1 = results[0], results[1]
|
||||||
assert len(round0) == len(round1)
|
assert len(round0) == len(round1)
|
||||||
|
|
||||||
|
passed = True
|
||||||
for page in xrange(len(round1)):
|
for page in xrange(len(round1)):
|
||||||
r0Page, r1Page = round0[page], round1[page]
|
r0Page, r1Page = round0[page], round1[page]
|
||||||
if r0Page is None:
|
if r0Page is None:
|
||||||
break
|
break
|
||||||
if r0Page.snapshot != r1Page.snapshot:
|
if r0Page.snapshot != r1Page.snapshot:
|
||||||
print 'TEST-UNEXPECTED-FAIL | forward-back-forward test', task['id'], '| in', browser, '| first rendering of page', page + 1, '!= second'
|
print 'TEST-UNEXPECTED-FAIL | forward-back-forward test', task['id'], '| in', browser, '| first rendering of page', page + 1, '!= second'
|
||||||
print 'TEST-PASS | forward-back-forward test', task['id'], '| in', browser
|
passed = False
|
||||||
|
State.numFBFFailures += 1
|
||||||
|
if passed:
|
||||||
|
print 'TEST-PASS | forward-back-forward test', task['id'], '| in', browser
|
||||||
|
|
||||||
|
|
||||||
def checkLoad(task, results, browser):
|
def checkLoad(task, results, browser):
|
||||||
@ -165,11 +250,55 @@ def checkLoad(task, results, browser):
|
|||||||
print 'TEST-PASS | load test', task['id'], '| in', browser
|
print 'TEST-PASS | load test', task['id'], '| in', browser
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def processResults():
|
||||||
set_up()
|
print ''
|
||||||
|
numErrors, numEqFailures, numEqNoSnapshot, numFBFFailures = State.numErrors, State.numEqFailures, State.numEqNoSnapshot, State.numFBFFailures
|
||||||
|
numFatalFailures = (numErrors + numFBFFailures)
|
||||||
|
if 0 == numEqFailures and 0 == numFatalFailures:
|
||||||
|
print 'All tests passed.'
|
||||||
|
else:
|
||||||
|
print 'OHNOES! Some tests failed!'
|
||||||
|
if 0 < numErrors:
|
||||||
|
print ' errors:', numErrors
|
||||||
|
if 0 < numEqFailures:
|
||||||
|
print ' different ref/snapshot:', numEqFailures
|
||||||
|
if 0 < numFBFFailures:
|
||||||
|
print ' different first/second rendering:', numFBFFailures
|
||||||
|
|
||||||
|
if State.masterMode and (0 < numEqFailures or 0 < numEqNoSnapshot):
|
||||||
|
print "Some eq tests failed or didn't have snapshots."
|
||||||
|
print 'Checking to see if master references can be updated...'
|
||||||
|
if 0 < numFatalFailures:
|
||||||
|
print ' No. Some non-eq tests failed.'
|
||||||
|
else:
|
||||||
|
' Yes! The references in tmp/ can be synced with ref/.'
|
||||||
|
if not prompt('Would you like to update the master copy in ref/?'):
|
||||||
|
print ' OK, not updating.'
|
||||||
|
else:
|
||||||
|
sys.stdout.write(' Updating ... ')
|
||||||
|
|
||||||
|
# XXX unclear what to do on errors here ...
|
||||||
|
# NB: do *NOT* pass --delete to rsync. That breaks this
|
||||||
|
# entire scheme.
|
||||||
|
subprocess.check_call(( 'rsync', '-arv', 'tmp/', 'ref/' ))
|
||||||
|
|
||||||
|
print 'done'
|
||||||
|
|
||||||
|
|
||||||
|
def main(args):
|
||||||
|
masterMode = False
|
||||||
|
manifestFile = DEFAULT_MANIFEST_FILE
|
||||||
|
if len(args) == 1:
|
||||||
|
masterMode = (args[0] == '-m')
|
||||||
|
manifestFile = args[0] if not masterMode else manifestFile
|
||||||
|
|
||||||
|
setUp(manifestFile, masterMode)
|
||||||
|
|
||||||
server = HTTPServer(('127.0.0.1', 8080), PDFTestHandler)
|
server = HTTPServer(('127.0.0.1', 8080), PDFTestHandler)
|
||||||
while not State.done:
|
while not State.done:
|
||||||
server.handle_request()
|
server.handle_request()
|
||||||
|
|
||||||
|
processResults()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main(sys.argv[1:])
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
[
|
[
|
||||||
{ "id": "tracemonkey-==",
|
{ "id": "tracemonkey-eq",
|
||||||
"file": "tests/tracemonkey.pdf",
|
"file": "tests/tracemonkey.pdf",
|
||||||
"rounds": 1,
|
"rounds": 1,
|
||||||
"type": "=="
|
"type": "eq"
|
||||||
},
|
},
|
||||||
{ "id": "tracemonkey-fbf",
|
{ "id": "tracemonkey-fbf",
|
||||||
"file": "tests/tracemonkey.pdf",
|
"file": "tests/tracemonkey.pdf",
|
||||||
@ -13,5 +13,11 @@
|
|||||||
"file": "tests/canvas.pdf",
|
"file": "tests/canvas.pdf",
|
||||||
"rounds": 1,
|
"rounds": 1,
|
||||||
"type": "load"
|
"type": "load"
|
||||||
|
},
|
||||||
|
{ "id": "pdfspec-load",
|
||||||
|
"file": "tests/pdf.pdf",
|
||||||
|
"link": true,
|
||||||
|
"rounds": 1,
|
||||||
|
"type": "load"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -5,9 +5,24 @@
|
|||||||
<script type="text/javascript" src="fonts.js"></script>
|
<script type="text/javascript" src="fonts.js"></script>
|
||||||
<script type="text/javascript" src="glyphlist.js"></script>
|
<script type="text/javascript" src="glyphlist.js"></script>
|
||||||
<script type="application/javascript">
|
<script type="application/javascript">
|
||||||
var canvas, currentTask, currentTaskIdx, failure, manifest, pdfDoc, stdout;
|
var browser, canvas, currentTask, currentTaskIdx, failure, manifest, pdfDoc, stdout;
|
||||||
|
|
||||||
|
function queryParams() {
|
||||||
|
var qs = window.location.search.substring(1);
|
||||||
|
var kvs = qs.split("&");
|
||||||
|
var params = { };
|
||||||
|
for (var i = 0; i < kvs.length; ++i) {
|
||||||
|
var kv = kvs[i].split("=");
|
||||||
|
params[unescape(kv[0])] = unescape(kv[1]);
|
||||||
|
}
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
function load() {
|
function load() {
|
||||||
|
var params = queryParams();
|
||||||
|
browser = params.browser;
|
||||||
|
manifestFile = params.manifestFile;
|
||||||
|
|
||||||
canvas = document.createElement("canvas");
|
canvas = document.createElement("canvas");
|
||||||
// 8.5x11in @ 100% ... XXX need something better here
|
// 8.5x11in @ 100% ... XXX need something better here
|
||||||
canvas.width = 816;
|
canvas.width = 816;
|
||||||
@ -15,10 +30,11 @@ function load() {
|
|||||||
canvas.mozOpaque = true;
|
canvas.mozOpaque = true;
|
||||||
stdout = document.getElementById("stdout");
|
stdout = document.getElementById("stdout");
|
||||||
|
|
||||||
|
log("Harness thinks this browser is '"+ browser +"'\n");
|
||||||
log("Fetching manifest ...");
|
log("Fetching manifest ...");
|
||||||
|
|
||||||
var r = new XMLHttpRequest();
|
var r = new XMLHttpRequest();
|
||||||
r.open("GET", "test_manifest.json", false);
|
r.open("GET", manifestFile, false);
|
||||||
r.onreadystatechange = function(e) {
|
r.onreadystatechange = function(e) {
|
||||||
if (r.readyState == 4) {
|
if (r.readyState == 4) {
|
||||||
log("done\n");
|
log("done\n");
|
||||||
@ -67,14 +83,13 @@ function nextPage() {
|
|||||||
failure = '';
|
failure = '';
|
||||||
log(" drawing page "+ currentTask.pageNum +"...");
|
log(" drawing page "+ currentTask.pageNum +"...");
|
||||||
|
|
||||||
currentPage = pdfDoc.getPage(currentTask.pageNum);
|
|
||||||
|
|
||||||
var ctx = canvas.getContext("2d");
|
var ctx = canvas.getContext("2d");
|
||||||
clear(ctx);
|
clear(ctx);
|
||||||
|
|
||||||
var fonts = [];
|
var fonts = [];
|
||||||
var gfx = new CanvasGraphics(ctx);
|
var gfx = new CanvasGraphics(ctx);
|
||||||
try {
|
try {
|
||||||
|
currentPage = pdfDoc.getPage(currentTask.pageNum);
|
||||||
currentPage.compile(gfx, fonts);
|
currentPage.compile(gfx, fonts);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
failure = 'compile: '+ e.toString();
|
failure = 'compile: '+ e.toString();
|
||||||
@ -111,7 +126,8 @@ function done() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function sendTaskResult(snapshot) {
|
function sendTaskResult(snapshot) {
|
||||||
var result = { id: currentTask.id,
|
var result = { browser: browser,
|
||||||
|
id: currentTask.id,
|
||||||
taskDone: currentTask.taskDone,
|
taskDone: currentTask.taskDone,
|
||||||
failure: failure,
|
failure: failure,
|
||||||
file: currentTask.file,
|
file: currentTask.file,
|
||||||
|
1
tests/pdf.pdf.link
Normal file
1
tests/pdf.pdf.link
Normal file
@ -0,0 +1 @@
|
|||||||
|
http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/pdf_reference_1-7.pdf
|
Loading…
Reference in New Issue
Block a user