Merge branch 'refs/heads/master' into text-select
This commit is contained in:
commit
dc33b24fae
1
Makefile
1
Makefile
@ -63,6 +63,7 @@ bundle: | $(BUILD_DIR)
|
|||||||
@cd src; \
|
@cd src; \
|
||||||
cat $(PDF_JS_FILES) > all_files.tmp; \
|
cat $(PDF_JS_FILES) > all_files.tmp; \
|
||||||
sed '/PDFJSSCRIPT_INCLUDE_ALL/ r all_files.tmp' pdf.js > ../$(BUILD_TARGET); \
|
sed '/PDFJSSCRIPT_INCLUDE_ALL/ r all_files.tmp' pdf.js > ../$(BUILD_TARGET); \
|
||||||
|
sed -i '' "s/PDFJSSCRIPT_BUNDLE_VER/`git log --format="%H" -n 1`/" ../$(BUILD_TARGET); \
|
||||||
rm -f *.tmp; \
|
rm -f *.tmp; \
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
|
18
README.md
18
README.md
@ -95,9 +95,17 @@ workings of PDF and pdf.js:
|
|||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
pdf.js is a community-driven project, so contributors are always welcome.
|
pdf.js is a community-driven project, so contributors are always welcome.
|
||||||
Simply fork our repo and contribute away. A great place to start is our
|
Simply fork our repo and contribute away. Good starting places for picking
|
||||||
[open issues](https://github.com/mozilla/pdf.js/issues). For better consistency and
|
a bug are the top error messages and TODOs in our corpus report:
|
||||||
long-term stability, please do look around the code and try to follow our conventions.
|
|
||||||
|
+ http://people.mozilla.com/~bdahl/corpusreport/test/ref/
|
||||||
|
|
||||||
|
and of course our open Github issues:
|
||||||
|
|
||||||
|
+ https://github.com/mozilla/pdf.js/issues
|
||||||
|
|
||||||
|
For better consistency and long-term stability, please do look around the
|
||||||
|
code and try to follow our conventions.
|
||||||
More information about the contributor process can be found on the
|
More information about the contributor process can be found on the
|
||||||
[contributor wiki page](https://github.com/mozilla/pdf.js/wiki/Contributing).
|
[contributor wiki page](https://github.com/mozilla/pdf.js/wiki/Contributing).
|
||||||
|
|
||||||
@ -152,9 +160,9 @@ See the bot repo for details:
|
|||||||
|
|
||||||
## Additional resources
|
## Additional resources
|
||||||
|
|
||||||
Our demo site is here:
|
Gallery of user projects and modifications:
|
||||||
|
|
||||||
+ http://mozilla.github.com/pdf.js/web/viewer.html
|
+ https://github.com/mozilla/pdf.js/wiki/Gallery-of-user-projects-and-modifications
|
||||||
|
|
||||||
You can read more about pdf.js here:
|
You can read more about pdf.js here:
|
||||||
|
|
||||||
|
@ -689,7 +689,9 @@ var CanvasGraphics = (function canvasGraphics() {
|
|||||||
setStrokeColor: function canvasGraphicsSetStrokeColor(/*...*/) {
|
setStrokeColor: function canvasGraphicsSetStrokeColor(/*...*/) {
|
||||||
var cs = this.current.strokeColorSpace;
|
var cs = this.current.strokeColorSpace;
|
||||||
var color = cs.getRgb(arguments);
|
var color = cs.getRgb(arguments);
|
||||||
this.setStrokeRGBColor.apply(this, color);
|
var color = Util.makeCssRgb.apply(null, cs.getRgb(arguments));
|
||||||
|
this.ctx.strokeStyle = color;
|
||||||
|
this.current.strokeColor = color;
|
||||||
},
|
},
|
||||||
getColorN_IR_Pattern: function canvasGraphicsGetColorN_IR_Pattern(IR, cs) {
|
getColorN_IR_Pattern: function canvasGraphicsGetColorN_IR_Pattern(IR, cs) {
|
||||||
if (IR[0] == 'TilingPattern') {
|
if (IR[0] == 'TilingPattern') {
|
||||||
@ -724,8 +726,9 @@ var CanvasGraphics = (function canvasGraphics() {
|
|||||||
},
|
},
|
||||||
setFillColor: function canvasGraphicsSetFillColor(/*...*/) {
|
setFillColor: function canvasGraphicsSetFillColor(/*...*/) {
|
||||||
var cs = this.current.fillColorSpace;
|
var cs = this.current.fillColorSpace;
|
||||||
var color = cs.getRgb(arguments);
|
var color = Util.makeCssRgb.apply(null, cs.getRgb(arguments));
|
||||||
this.setFillRGBColor.apply(this, color);
|
this.ctx.fillStyle = color;
|
||||||
|
this.current.fillColor = color;
|
||||||
},
|
},
|
||||||
setFillColorN_IR: function canvasGraphicsSetFillColorN(/*...*/) {
|
setFillColorN_IR: function canvasGraphicsSetFillColorN(/*...*/) {
|
||||||
var cs = this.current.fillColorSpace;
|
var cs = this.current.fillColorSpace;
|
||||||
@ -737,27 +740,49 @@ var CanvasGraphics = (function canvasGraphics() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
setStrokeGray: function canvasGraphicsSetStrokeGray(gray) {
|
setStrokeGray: function canvasGraphicsSetStrokeGray(gray) {
|
||||||
this.setStrokeRGBColor(gray, gray, gray);
|
if (!(this.current.strokeColorSpace instanceof DeviceGrayCS))
|
||||||
|
this.current.strokeColorSpace = new DeviceGrayCS();
|
||||||
|
|
||||||
|
var color = Util.makeCssRgb(gray, gray, gray);
|
||||||
|
this.ctx.strokeStyle = color;
|
||||||
|
this.current.strokeColor = color;
|
||||||
},
|
},
|
||||||
setFillGray: function canvasGraphicsSetFillGray(gray) {
|
setFillGray: function canvasGraphicsSetFillGray(gray) {
|
||||||
this.setFillRGBColor(gray, gray, gray);
|
if (!(this.current.fillColorSpace instanceof DeviceGrayCS))
|
||||||
|
this.current.fillColorSpace = new DeviceGrayCS();
|
||||||
|
|
||||||
|
var color = Util.makeCssRgb(gray, gray, gray);
|
||||||
|
this.ctx.fillStyle = color;
|
||||||
|
this.current.fillColor = color;
|
||||||
},
|
},
|
||||||
setStrokeRGBColor: function canvasGraphicsSetStrokeRGBColor(r, g, b) {
|
setStrokeRGBColor: function canvasGraphicsSetStrokeRGBColor(r, g, b) {
|
||||||
|
if (!(this.current.strokeColorSpace instanceof DeviceRgbCS))
|
||||||
|
this.current.strokeColorSpace = new DeviceRgbCS();
|
||||||
|
|
||||||
var color = Util.makeCssRgb(r, g, b);
|
var color = Util.makeCssRgb(r, g, b);
|
||||||
this.ctx.strokeStyle = color;
|
this.ctx.strokeStyle = color;
|
||||||
this.current.strokeColor = color;
|
this.current.strokeColor = color;
|
||||||
},
|
},
|
||||||
setFillRGBColor: function canvasGraphicsSetFillRGBColor(r, g, b) {
|
setFillRGBColor: function canvasGraphicsSetFillRGBColor(r, g, b) {
|
||||||
|
if (!(this.current.fillColorSpace instanceof DeviceRgbCS))
|
||||||
|
this.current.fillColorSpace = new DeviceRgbCS();
|
||||||
|
|
||||||
var color = Util.makeCssRgb(r, g, b);
|
var color = Util.makeCssRgb(r, g, b);
|
||||||
this.ctx.fillStyle = color;
|
this.ctx.fillStyle = color;
|
||||||
this.current.fillColor = color;
|
this.current.fillColor = color;
|
||||||
},
|
},
|
||||||
setStrokeCMYKColor: function canvasGraphicsSetStrokeCMYKColor(c, m, y, k) {
|
setStrokeCMYKColor: function canvasGraphicsSetStrokeCMYKColor(c, m, y, k) {
|
||||||
|
if (!(this.current.strokeColorSpace instanceof DeviceCmykCS))
|
||||||
|
this.current.strokeColorSpace = new DeviceCmykCS();
|
||||||
|
|
||||||
var color = Util.makeCssCmyk(c, m, y, k);
|
var color = Util.makeCssCmyk(c, m, y, k);
|
||||||
this.ctx.strokeStyle = color;
|
this.ctx.strokeStyle = color;
|
||||||
this.current.strokeColor = color;
|
this.current.strokeColor = color;
|
||||||
},
|
},
|
||||||
setFillCMYKColor: function canvasGraphicsSetFillCMYKColor(c, m, y, k) {
|
setFillCMYKColor: function canvasGraphicsSetFillCMYKColor(c, m, y, k) {
|
||||||
|
if (!(this.current.fillColorSpace instanceof DeviceCmykCS))
|
||||||
|
this.current.fillColorSpace = new DeviceCmykCS();
|
||||||
|
|
||||||
var color = Util.makeCssCmyk(c, m, y, k);
|
var color = Util.makeCssCmyk(c, m, y, k);
|
||||||
this.ctx.fillStyle = color;
|
this.ctx.fillStyle = color;
|
||||||
this.current.fillColor = color;
|
this.current.fillColor = color;
|
||||||
|
@ -522,7 +522,9 @@ var PartialEvaluator = (function partialEvaluator() {
|
|||||||
var cmapObj = xref.fetchIfRef(toUnicode);
|
var cmapObj = xref.fetchIfRef(toUnicode);
|
||||||
var charToUnicode = [];
|
var charToUnicode = [];
|
||||||
if (isName(cmapObj)) {
|
if (isName(cmapObj)) {
|
||||||
error('ToUnicode file cmap translation not implemented');
|
var isIdentityMap = cmapObj.name.substr(0, 9) == 'Identity-';
|
||||||
|
if (!isIdentityMap)
|
||||||
|
error('ToUnicode file cmap translation not implemented');
|
||||||
} else if (isStream(cmapObj)) {
|
} else if (isStream(cmapObj)) {
|
||||||
var tokens = [];
|
var tokens = [];
|
||||||
var token = '';
|
var token = '';
|
||||||
|
@ -7,8 +7,9 @@ var PDFJS = {};
|
|||||||
// Use strict in our context only - users might not want it
|
// Use strict in our context only - users might not want it
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
PDFJS.build = 'PDFJSSCRIPT_BUNDLE_VER';
|
||||||
|
|
||||||
// Files are inserted below - see Makefile
|
// Files are inserted below - see Makefile
|
||||||
/* PDFJSSCRIPT_INCLUDE_ALL */
|
/* PDFJSSCRIPT_INCLUDE_ALL */
|
||||||
|
|
||||||
}).call((typeof window === 'undefined') ? this : window);
|
}).call((typeof window === 'undefined') ? this : window);
|
||||||
|
|
||||||
|
@ -56,23 +56,29 @@ function load() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function cleanup() {
|
function cleanup() {
|
||||||
var styleSheet = document.styleSheets[0];
|
// Clear out all the stylesheets since a new one is created for each font.
|
||||||
if (styleSheet) {
|
while (document.styleSheets.length > 0) {
|
||||||
|
var styleSheet = document.styleSheets[0];
|
||||||
while (styleSheet.cssRules.length > 0)
|
while (styleSheet.cssRules.length > 0)
|
||||||
styleSheet.deleteRule(0);
|
styleSheet.deleteRule(0);
|
||||||
|
var ownerNode = styleSheet.ownerNode;
|
||||||
|
ownerNode.parentNode.removeChild(ownerNode);
|
||||||
}
|
}
|
||||||
var guard = document.getElementById('content-end');
|
var guard = document.getElementById('content-end');
|
||||||
var body = document.body;
|
var body = document.body;
|
||||||
while (body.lastChild !== guard)
|
while (body.lastChild !== guard)
|
||||||
body.removeChild(body.lastChild);
|
body.removeChild(body.lastChild);
|
||||||
|
|
||||||
|
// Wipe out the link to the pdfdoc so it can be GC'ed.
|
||||||
|
for (var i = 0; i < manifest.length; i++) {
|
||||||
|
if (manifest[i].pdfDoc) {
|
||||||
|
manifest[i].pdfDoc.destroy();
|
||||||
|
delete manifest[i].pdfDoc;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function nextTask() {
|
function nextTask() {
|
||||||
// If there is a pdfDoc on the last task executed, destroy it to free memory.
|
|
||||||
if (task && task.pdfDoc) {
|
|
||||||
task.pdfDoc.destroy();
|
|
||||||
delete task.pdfDoc;
|
|
||||||
}
|
|
||||||
cleanup();
|
cleanup();
|
||||||
|
|
||||||
if (currentTaskIdx == manifest.length) {
|
if (currentTaskIdx == manifest.length) {
|
||||||
|
@ -323,18 +323,18 @@ def verifyPDFs(manifestList):
|
|||||||
if os.access(f, os.R_OK):
|
if os.access(f, os.R_OK):
|
||||||
fileMd5 = hashlib.md5(open(f, 'rb').read()).hexdigest()
|
fileMd5 = hashlib.md5(open(f, 'rb').read()).hexdigest()
|
||||||
if 'md5' not in item:
|
if 'md5' not in item:
|
||||||
print 'ERROR: Missing md5 for file "' + f + '".',
|
print 'WARNING: Missing md5 for file "' + f + '".',
|
||||||
print 'Hash for current file is "' + fileMd5 + '"'
|
print 'Hash for current file is "' + fileMd5 + '"'
|
||||||
error = True
|
error = True
|
||||||
continue
|
continue
|
||||||
md5 = item['md5']
|
md5 = item['md5']
|
||||||
if fileMd5 != md5:
|
if fileMd5 != md5:
|
||||||
print 'ERROR: MD5 of file "' + f + '" does not match file.',
|
print 'WARNING: MD5 of file "' + f + '" does not match file.',
|
||||||
print 'Expected "' + md5 + '" computed "' + fileMd5 + '"'
|
print 'Expected "' + md5 + '" computed "' + fileMd5 + '"'
|
||||||
error = True
|
error = True
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
print 'ERROR: Unable to open file for reading "' + f + '".'
|
print 'WARNING: Unable to open file for reading "' + f + '".'
|
||||||
error = True
|
error = True
|
||||||
return not error
|
return not error
|
||||||
|
|
||||||
@ -365,7 +365,8 @@ def setUp(options):
|
|||||||
downloadLinkedPDFs(manifestList)
|
downloadLinkedPDFs(manifestList)
|
||||||
|
|
||||||
if not verifyPDFs(manifestList):
|
if not verifyPDFs(manifestList):
|
||||||
raise Exception('ERROR: failed to verify pdfs.')
|
print 'Unable to verify the checksum for the files that are used for testing.'
|
||||||
|
print 'Please re-download the files, or adjust the MD5 checksum in the manifest for the files listed above.\n'
|
||||||
|
|
||||||
for b in testBrowsers:
|
for b in testBrowsers:
|
||||||
State.taskResults[b.name] = { }
|
State.taskResults[b.name] = { }
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
},
|
},
|
||||||
{ "id": "intelisa-load",
|
{ "id": "intelisa-load",
|
||||||
"file": "pdfs/intelisa.pdf",
|
"file": "pdfs/intelisa.pdf",
|
||||||
"md5": "f3ed5487d1afa34d8b77c0c734a95c79",
|
"md5": "f5712097d29287a97f1278839814f682",
|
||||||
"link": true,
|
"link": true,
|
||||||
"rounds": 1,
|
"rounds": 1,
|
||||||
"type": "load"
|
"type": "load"
|
||||||
@ -194,7 +194,7 @@
|
|||||||
},
|
},
|
||||||
{ "id": "f1040",
|
{ "id": "f1040",
|
||||||
"file": "pdfs/f1040.pdf",
|
"file": "pdfs/f1040.pdf",
|
||||||
"md5": "7323b50c6d28d959b8b4b92c469b2469",
|
"md5": "b59272ce19b4a0c5808c8861441b0741",
|
||||||
"link": true,
|
"link": true,
|
||||||
"rounds": 1,
|
"rounds": 1,
|
||||||
"type": "load"
|
"type": "load"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user