Skip to content

Conversation

@edoardocavazza
Copy link
Contributor

Some marked contents have a Lang attribute defined in the props passed to the beginMarkedContentProps operator. With this PR, the evaluator extracts this information. I chose to pass the props object as third argument in order to maintain backwards compatibility, but I'm open to changes.

const pdfDoc = await loadingTask.promise;
const pdfPage = await pdfDoc.getPage(1);

pdfDoc.annotationStorage.setValue("30R", { value: "test" });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no annotations in the pdf so I don't see the point of setting these values.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh I am sorry, bad copy/paste from a previous test. Removed

const opList = await pdfPage.getOperatorList({
annotationMode: AnnotationMode.DISABLE,
});
expect(opList.fnArray[0]).toEqual(OPS.beginMarkedContentProps);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it useful to get the lang parameter in the operator list which is used to draw the pdf ?

props.lang = stringToPDFString(lang);
}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As said in the test, I don't understand why it's useful.
That said, I don't really see the point of having the MCID neither...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO, it's correct for an API called getOperatorList to return the complete list of operators and their arguments, as well as the MCID. It's then up to the rendering scripts to decide whether or not to use that data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants