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 @@ @@ -1,6 +1,6 @@
{
"name": "pdfjs-dist",
"version": "1.5.355",
"version": "1.5.357",
"main": [
"build/pdf.js",
"build/pdf.worker.js"

35
build/pdf.combined.js

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

13
build/pdf.js

@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdf = {})); @@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdf = {}));
// Use strict in our context only - users might not want it
'use strict';
var pdfjsVersion = '1.5.355';
var pdfjsBuild = '336b26a';
var pdfjsVersion = '1.5.357';
var pdfjsBuild = 'a02e268';
var pdfjsFilePath =
typeof document !== 'undefined' && document.currentScript ?
@ -9147,6 +9147,8 @@ var PDFDocumentProxy = (function PDFDocumentProxyClosure() { @@ -9147,6 +9147,8 @@ var PDFDocumentProxy = (function PDFDocumentProxyClosure() {
* @typedef {Object} getTextContentParameters
* @param {boolean} normalizeWhitespace - replaces all occurrences of
* 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() { @@ -9438,11 +9440,12 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
* object that represent the page text content.
*/
getTextContent: function PDFPageProxy_getTextContent(params) {
var normalizeWhitespace = (params && params.normalizeWhitespace) || false;
return this.transport.messageHandler.sendWithPromise('GetTextContent', {
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 = {})); @@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdfWorker = {}));
// Use strict in our context only - users might not want it
'use strict';
var pdfjsVersion = '1.5.355';
var pdfjsBuild = '336b26a';
var pdfjsVersion = '1.5.357';
var pdfjsBuild = 'a02e268';
var pdfjsFilePath =
typeof document !== 'undefined' && document.currentScript ?
@ -37899,7 +37899,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { @@ -37899,7 +37899,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
getTextContent:
function PartialEvaluator_getTextContent(stream, task, resources,
stateManager,
normalizeWhitespace) {
normalizeWhitespace,
combineTextItems) {
stateManager = (stateManager || new StateManager(new TextState()));
@ -38210,7 +38211,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { @@ -38210,7 +38211,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
var isSameTextLine = !textState.font ? false :
((textState.font.vertical ? args[0] : args[1]) === 0);
advance = args[0] - args[1];
if (isSameTextLine && textContentItem.initialized &&
if (combineTextItems &&
isSameTextLine && textContentItem.initialized &&
advance > 0 &&
advance <= textContentItem.fakeMultiSpaceMax) {
textState.translateTextLineMatrix(args[0], args[1]);
@ -38242,7 +38244,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { @@ -38242,7 +38244,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
// Optimization to treat same line movement as advance.
advance = textState.calcTextLineMatrixAdvance(
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 <= textContentItem.fakeMultiSpaceMax) {
textState.translateTextLineMatrix(advance.width,
@ -38383,7 +38386,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { @@ -38383,7 +38386,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
next(self.getTextContent(xobj, task,
xobj.dict.get('Resources') || resources, stateManager,
normalizeWhitespace).then(function (formTextContent) {
normalizeWhitespace, combineTextItems).then(
function (formTextContent) {
Util.appendToArray(textContent.items, formTextContent.items);
Util.extendObj(textContent.styles, formTextContent.styles);
stateManager.restore();
@ -41236,7 +41240,8 @@ var Page = (function PageClosure() { @@ -41236,7 +41240,8 @@ var Page = (function PageClosure() {
},
extractTextContent: function Page_extractTextContent(task,
normalizeWhitespace) {
normalizeWhitespace,
combineTextItems) {
var handler = {
on: function nullHandlerOn() {},
send: function nullHandlerSend() {}
@ -41269,7 +41274,8 @@ var Page = (function PageClosure() { @@ -41269,7 +41274,8 @@ var Page = (function PageClosure() {
task,
self.resources,
/* stateManager = */ null,
normalizeWhitespace);
normalizeWhitespace,
combineTextItems);
});
},
@ -42533,12 +42539,14 @@ var WorkerMessageHandler = { @@ -42533,12 +42539,14 @@ var WorkerMessageHandler = {
handler.on('GetTextContent', function wphExtractText(data) {
var pageIndex = data.pageIndex;
var normalizeWhitespace = data.normalizeWhitespace;
var combineTextItems = data.combineTextItems;
return pdfManager.getPage(pageIndex).then(function(page) {
var task = new WorkerTask('GetTextContent: page ' + pageIndex);
startWorkerTask(task);
var pageNum = pageIndex + 1;
var start = Date.now();
return page.extractTextContent(task, normalizeWhitespace).then(
return page.extractTextContent(task, normalizeWhitespace,
combineTextItems).then(
function(textContent) {
finishWorkerTask(task);
info('text indexing: page=' + pageNum + ' - time=' +

2
package.json

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

16
web/pdf_viewer.js

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

Loading…
Cancel
Save