Browse Source

PDF.js version 1.5.357 - See mozilla/pdf.js@a02e2686b94af387c62231acbcf0542a7023e8cd

master v1.5.357
Pdf Bot 9 years ago
parent
commit
768c53eca2
  1. 2
      bower.json
  2. 35
      build/pdf.combined.js
  3. 13
      build/pdf.js
  4. 26
      build/pdf.worker.js
  5. 2
      package.json
  6. 16
      web/pdf_viewer.js

2
bower.json

@ -1,6 +1,6 @@
{ {
"name": "pdfjs-dist", "name": "pdfjs-dist",
"version": "1.5.355", "version": "1.5.357",
"main": [ "main": [
"build/pdf.js", "build/pdf.js",
"build/pdf.worker.js" "build/pdf.worker.js"

35
build/pdf.combined.js

@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdfCombined = {}));
// 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';
var pdfjsVersion = '1.5.355'; var pdfjsVersion = '1.5.357';
var pdfjsBuild = '336b26a'; var pdfjsBuild = 'a02e268';
var pdfjsFilePath = var pdfjsFilePath =
typeof document !== 'undefined' && document.currentScript ? typeof document !== 'undefined' && document.currentScript ?
@ -39178,6 +39178,8 @@ var PDFDocumentProxy = (function PDFDocumentProxyClosure() {
* @typedef {Object} getTextContentParameters * @typedef {Object} getTextContentParameters
* @param {boolean} normalizeWhitespace - replaces all occurrences of * @param {boolean} normalizeWhitespace - replaces all occurrences of
* whitespace with standard spaces (0x20). The default value is `false`. * whitespace with standard spaces (0x20). The default value is `false`.
* @param {boolean} disableCombineTextItems - do not attempt to combine
* same line {@link TextItem}'s. The default value is `false`.
*/ */
/** /**
@ -39469,11 +39471,12 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
* object that represent the page text content. * object that represent the page text content.
*/ */
getTextContent: function PDFPageProxy_getTextContent(params) { getTextContent: function PDFPageProxy_getTextContent(params) {
var normalizeWhitespace = (params && params.normalizeWhitespace) || false;
return this.transport.messageHandler.sendWithPromise('GetTextContent', { return this.transport.messageHandler.sendWithPromise('GetTextContent', {
pageIndex: this.pageNumber - 1, pageIndex: this.pageNumber - 1,
normalizeWhitespace: normalizeWhitespace, normalizeWhitespace: (params && params.normalizeWhitespace === true ?
true : /* Default */ false),
combineTextItems: (params && params.disableCombineTextItems === true ?
false : /* Default */ true),
}); });
}, },
@ -46245,7 +46248,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
getTextContent: getTextContent:
function PartialEvaluator_getTextContent(stream, task, resources, function PartialEvaluator_getTextContent(stream, task, resources,
stateManager, stateManager,
normalizeWhitespace) { normalizeWhitespace,
combineTextItems) {
stateManager = (stateManager || new StateManager(new TextState())); stateManager = (stateManager || new StateManager(new TextState()));
@ -46556,7 +46560,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
var isSameTextLine = !textState.font ? false : var isSameTextLine = !textState.font ? false :
((textState.font.vertical ? args[0] : args[1]) === 0); ((textState.font.vertical ? args[0] : args[1]) === 0);
advance = args[0] - args[1]; advance = args[0] - args[1];
if (isSameTextLine && textContentItem.initialized && if (combineTextItems &&
isSameTextLine && textContentItem.initialized &&
advance > 0 && advance > 0 &&
advance <= textContentItem.fakeMultiSpaceMax) { advance <= textContentItem.fakeMultiSpaceMax) {
textState.translateTextLineMatrix(args[0], args[1]); textState.translateTextLineMatrix(args[0], args[1]);
@ -46588,7 +46593,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
// Optimization to treat same line movement as advance. // Optimization to treat same line movement as advance.
advance = textState.calcTextLineMatrixAdvance( advance = textState.calcTextLineMatrixAdvance(
args[0], args[1], args[2], args[3], args[4], args[5]); args[0], args[1], args[2], args[3], args[4], args[5]);
if (advance !== null && textContentItem.initialized && if (combineTextItems &&
advance !== null && textContentItem.initialized &&
advance.value > 0 && advance.value > 0 &&
advance.value <= textContentItem.fakeMultiSpaceMax) { advance.value <= textContentItem.fakeMultiSpaceMax) {
textState.translateTextLineMatrix(advance.width, textState.translateTextLineMatrix(advance.width,
@ -46729,7 +46735,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
next(self.getTextContent(xobj, task, next(self.getTextContent(xobj, task,
xobj.dict.get('Resources') || resources, stateManager, xobj.dict.get('Resources') || resources, stateManager,
normalizeWhitespace).then(function (formTextContent) { normalizeWhitespace, combineTextItems).then(
function (formTextContent) {
Util.appendToArray(textContent.items, formTextContent.items); Util.appendToArray(textContent.items, formTextContent.items);
Util.extendObj(textContent.styles, formTextContent.styles); Util.extendObj(textContent.styles, formTextContent.styles);
stateManager.restore(); stateManager.restore();
@ -49582,7 +49589,8 @@ var Page = (function PageClosure() {
}, },
extractTextContent: function Page_extractTextContent(task, extractTextContent: function Page_extractTextContent(task,
normalizeWhitespace) { normalizeWhitespace,
combineTextItems) {
var handler = { var handler = {
on: function nullHandlerOn() {}, on: function nullHandlerOn() {},
send: function nullHandlerSend() {} send: function nullHandlerSend() {}
@ -49615,7 +49623,8 @@ var Page = (function PageClosure() {
task, task,
self.resources, self.resources,
/* stateManager = */ null, /* stateManager = */ null,
normalizeWhitespace); normalizeWhitespace,
combineTextItems);
}); });
}, },
@ -50879,12 +50888,14 @@ var WorkerMessageHandler = {
handler.on('GetTextContent', function wphExtractText(data) { handler.on('GetTextContent', function wphExtractText(data) {
var pageIndex = data.pageIndex; var pageIndex = data.pageIndex;
var normalizeWhitespace = data.normalizeWhitespace; var normalizeWhitespace = data.normalizeWhitespace;
var combineTextItems = data.combineTextItems;
return pdfManager.getPage(pageIndex).then(function(page) { return pdfManager.getPage(pageIndex).then(function(page) {
var task = new WorkerTask('GetTextContent: page ' + pageIndex); var task = new WorkerTask('GetTextContent: page ' + pageIndex);
startWorkerTask(task); startWorkerTask(task);
var pageNum = pageIndex + 1; var pageNum = pageIndex + 1;
var start = Date.now(); var start = Date.now();
return page.extractTextContent(task, normalizeWhitespace).then( return page.extractTextContent(task, normalizeWhitespace,
combineTextItems).then(
function(textContent) { function(textContent) {
finishWorkerTask(task); finishWorkerTask(task);
info('text indexing: page=' + pageNum + ' - time=' + info('text indexing: page=' + pageNum + ' - time=' +

13
build/pdf.js

@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdf = {}));
// 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';
var pdfjsVersion = '1.5.355'; var pdfjsVersion = '1.5.357';
var pdfjsBuild = '336b26a'; var pdfjsBuild = 'a02e268';
var pdfjsFilePath = var pdfjsFilePath =
typeof document !== 'undefined' && document.currentScript ? typeof document !== 'undefined' && document.currentScript ?
@ -9147,6 +9147,8 @@ var PDFDocumentProxy = (function PDFDocumentProxyClosure() {
* @typedef {Object} getTextContentParameters * @typedef {Object} getTextContentParameters
* @param {boolean} normalizeWhitespace - replaces all occurrences of * @param {boolean} normalizeWhitespace - replaces all occurrences of
* whitespace with standard spaces (0x20). The default value is `false`. * whitespace with standard spaces (0x20). The default value is `false`.
* @param {boolean} disableCombineTextItems - do not attempt to combine
* same line {@link TextItem}'s. The default value is `false`.
*/ */
/** /**
@ -9438,11 +9440,12 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
* object that represent the page text content. * object that represent the page text content.
*/ */
getTextContent: function PDFPageProxy_getTextContent(params) { getTextContent: function PDFPageProxy_getTextContent(params) {
var normalizeWhitespace = (params && params.normalizeWhitespace) || false;
return this.transport.messageHandler.sendWithPromise('GetTextContent', { return this.transport.messageHandler.sendWithPromise('GetTextContent', {
pageIndex: this.pageNumber - 1, pageIndex: this.pageNumber - 1,
normalizeWhitespace: normalizeWhitespace, normalizeWhitespace: (params && params.normalizeWhitespace === true ?
true : /* Default */ false),
combineTextItems: (params && params.disableCombineTextItems === true ?
false : /* Default */ true),
}); });
}, },

26
build/pdf.worker.js vendored

@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdfWorker = {}));
// 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';
var pdfjsVersion = '1.5.355'; var pdfjsVersion = '1.5.357';
var pdfjsBuild = '336b26a'; var pdfjsBuild = 'a02e268';
var pdfjsFilePath = var pdfjsFilePath =
typeof document !== 'undefined' && document.currentScript ? typeof document !== 'undefined' && document.currentScript ?
@ -37899,7 +37899,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
getTextContent: getTextContent:
function PartialEvaluator_getTextContent(stream, task, resources, function PartialEvaluator_getTextContent(stream, task, resources,
stateManager, stateManager,
normalizeWhitespace) { normalizeWhitespace,
combineTextItems) {
stateManager = (stateManager || new StateManager(new TextState())); stateManager = (stateManager || new StateManager(new TextState()));
@ -38210,7 +38211,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
var isSameTextLine = !textState.font ? false : var isSameTextLine = !textState.font ? false :
((textState.font.vertical ? args[0] : args[1]) === 0); ((textState.font.vertical ? args[0] : args[1]) === 0);
advance = args[0] - args[1]; advance = args[0] - args[1];
if (isSameTextLine && textContentItem.initialized && if (combineTextItems &&
isSameTextLine && textContentItem.initialized &&
advance > 0 && advance > 0 &&
advance <= textContentItem.fakeMultiSpaceMax) { advance <= textContentItem.fakeMultiSpaceMax) {
textState.translateTextLineMatrix(args[0], args[1]); textState.translateTextLineMatrix(args[0], args[1]);
@ -38242,7 +38244,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
// Optimization to treat same line movement as advance. // Optimization to treat same line movement as advance.
advance = textState.calcTextLineMatrixAdvance( advance = textState.calcTextLineMatrixAdvance(
args[0], args[1], args[2], args[3], args[4], args[5]); args[0], args[1], args[2], args[3], args[4], args[5]);
if (advance !== null && textContentItem.initialized && if (combineTextItems &&
advance !== null && textContentItem.initialized &&
advance.value > 0 && advance.value > 0 &&
advance.value <= textContentItem.fakeMultiSpaceMax) { advance.value <= textContentItem.fakeMultiSpaceMax) {
textState.translateTextLineMatrix(advance.width, textState.translateTextLineMatrix(advance.width,
@ -38383,7 +38386,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
next(self.getTextContent(xobj, task, next(self.getTextContent(xobj, task,
xobj.dict.get('Resources') || resources, stateManager, xobj.dict.get('Resources') || resources, stateManager,
normalizeWhitespace).then(function (formTextContent) { normalizeWhitespace, combineTextItems).then(
function (formTextContent) {
Util.appendToArray(textContent.items, formTextContent.items); Util.appendToArray(textContent.items, formTextContent.items);
Util.extendObj(textContent.styles, formTextContent.styles); Util.extendObj(textContent.styles, formTextContent.styles);
stateManager.restore(); stateManager.restore();
@ -41236,7 +41240,8 @@ var Page = (function PageClosure() {
}, },
extractTextContent: function Page_extractTextContent(task, extractTextContent: function Page_extractTextContent(task,
normalizeWhitespace) { normalizeWhitespace,
combineTextItems) {
var handler = { var handler = {
on: function nullHandlerOn() {}, on: function nullHandlerOn() {},
send: function nullHandlerSend() {} send: function nullHandlerSend() {}
@ -41269,7 +41274,8 @@ var Page = (function PageClosure() {
task, task,
self.resources, self.resources,
/* stateManager = */ null, /* stateManager = */ null,
normalizeWhitespace); normalizeWhitespace,
combineTextItems);
}); });
}, },
@ -42533,12 +42539,14 @@ var WorkerMessageHandler = {
handler.on('GetTextContent', function wphExtractText(data) { handler.on('GetTextContent', function wphExtractText(data) {
var pageIndex = data.pageIndex; var pageIndex = data.pageIndex;
var normalizeWhitespace = data.normalizeWhitespace; var normalizeWhitespace = data.normalizeWhitespace;
var combineTextItems = data.combineTextItems;
return pdfManager.getPage(pageIndex).then(function(page) { return pdfManager.getPage(pageIndex).then(function(page) {
var task = new WorkerTask('GetTextContent: page ' + pageIndex); var task = new WorkerTask('GetTextContent: page ' + pageIndex);
startWorkerTask(task); startWorkerTask(task);
var pageNum = pageIndex + 1; var pageNum = pageIndex + 1;
var start = Date.now(); var start = Date.now();
return page.extractTextContent(task, normalizeWhitespace).then( return page.extractTextContent(task, normalizeWhitespace,
combineTextItems).then(
function(textContent) { function(textContent) {
finishWorkerTask(task); finishWorkerTask(task);
info('text indexing: page=' + pageNum + ' - time=' + info('text indexing: page=' + pageNum + ' - time=' +

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "pdfjs-dist", "name": "pdfjs-dist",
"version": "1.5.355", "version": "1.5.357",
"main": "build/pdf.js", "main": "build/pdf.js",
"description": "Generic build of Mozilla's PDF.js library.", "description": "Generic build of Mozilla's PDF.js library.",
"keywords": [ "keywords": [

16
web/pdf_viewer.js

@ -2722,12 +2722,12 @@ var PDFPageView = (function PDFPageViewClosure() {
function pdfPageRenderCallback() { function pdfPageRenderCallback() {
pageViewDrawCallback(null); pageViewDrawCallback(null);
if (textLayer) { if (textLayer) {
self.pdfPage.getTextContent({ normalizeWhitespace: true }).then( self.pdfPage.getTextContent({
function textContentResolved(textContent) { normalizeWhitespace: true,
textLayer.setTextContent(textContent); }).then(function textContentResolved(textContent) {
textLayer.render(TEXT_LAYER_RENDER_DELAY); textLayer.setTextContent(textContent);
} textLayer.render(TEXT_LAYER_RENDER_DELAY);
); });
} }
}, },
function pdfPageRenderError(error) { function pdfPageRenderError(error) {
@ -4045,7 +4045,9 @@ var PDFViewer = (function pdfViewer() {
getPageTextContent: function (pageIndex) { getPageTextContent: function (pageIndex) {
return this.pdfDocument.getPage(pageIndex + 1).then(function (page) { return this.pdfDocument.getPage(pageIndex + 1).then(function (page) {
return page.getTextContent({ normalizeWhitespace: true }); return page.getTextContent({
normalizeWhitespace: true,
});
}); });
}, },

Loading…
Cancel
Save