mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
Merge pull request #13746 from Snuffleupagus/getOperatorList-intent
[api-minor] Add `intent` support to the `PDFPageProxy.getOperatorList` method (issue 13704)
This commit is contained in:
commit
668c58d68d
7 changed files with 121 additions and 17 deletions
|
@ -702,7 +702,13 @@ class Annotation {
|
|||
|
||||
return resourcesPromise.then(resources => {
|
||||
const opList = new OperatorList();
|
||||
opList.addOp(OPS.beginAnnotation, [data.rect, transform, matrix]);
|
||||
opList.addOp(OPS.beginAnnotation, [
|
||||
data.id,
|
||||
data.rect,
|
||||
transform,
|
||||
matrix,
|
||||
]);
|
||||
|
||||
return evaluator
|
||||
.getOperatorList({
|
||||
stream: appearance,
|
||||
|
@ -1307,6 +1313,7 @@ class WidgetAnnotation extends Annotation {
|
|||
|
||||
const transform = getTransformMatrix(this.data.rect, bbox, matrix);
|
||||
operatorList.addOp(OPS.beginAnnotation, [
|
||||
this.data.id,
|
||||
this.data.rect,
|
||||
transform,
|
||||
matrix,
|
||||
|
|
|
@ -366,12 +366,16 @@ class Page {
|
|||
|
||||
// Collect the operator list promises for the annotations. Each promise
|
||||
// is resolved with the complete operator list for a single annotation.
|
||||
const annotationIntent = intent.startsWith("oplist-")
|
||||
? intent.split("-")[1]
|
||||
: intent;
|
||||
const opListPromises = [];
|
||||
for (const annotation of annotations) {
|
||||
if (
|
||||
(intent === "display" &&
|
||||
(annotationIntent === "display" &&
|
||||
annotation.mustBeViewed(annotationStorage)) ||
|
||||
(intent === "print" && annotation.mustBePrinted(annotationStorage))
|
||||
(annotationIntent === "print" &&
|
||||
annotation.mustBePrinted(annotationStorage))
|
||||
) {
|
||||
opListPromises.push(
|
||||
annotation
|
||||
|
|
|
@ -594,14 +594,14 @@ class OperatorList {
|
|||
|
||||
// Close to chunk size.
|
||||
static get CHUNK_SIZE_ABOUT() {
|
||||
return shadow(this, "CHUNK_SIZE_ABOUT", OperatorList.CHUNK_SIZE - 5);
|
||||
return shadow(this, "CHUNK_SIZE_ABOUT", this.CHUNK_SIZE - 5);
|
||||
}
|
||||
|
||||
constructor(intent, streamSink) {
|
||||
this._streamSink = streamSink;
|
||||
this.fnArray = [];
|
||||
this.argsArray = [];
|
||||
if (streamSink && intent !== "oplist") {
|
||||
if (streamSink && !(intent && intent.startsWith("oplist-"))) {
|
||||
this.optimizer = new QueueOptimizer(this);
|
||||
} else {
|
||||
this.optimizer = new NullOptimizer(this);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue