mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 09:45:42 +02:00
[api-minor] Add a parameter to PDFPageProxy_getTextContent
that controls whether PartialEvaluator_getTextContent
will attempt to combine same line text items
From the discussion in issue 7445, it seems that there may be cases where an API consumer would want to get the text content as is, without combined text items.
This commit is contained in:
parent
9228a04061
commit
f297e4d17c
8 changed files with 42 additions and 27 deletions
|
@ -600,6 +600,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`.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -891,11 +893,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),
|
||||
});
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue