mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Render not displayed annotations in using normal appearance when printing
This commit is contained in:
parent
b2a4dacd31
commit
6be2f84b4e
6 changed files with 204 additions and 6 deletions
|
@ -1137,7 +1137,8 @@ class WidgetAnnotation extends Annotation {
|
|||
}
|
||||
|
||||
async save(evaluator, task, annotationStorage) {
|
||||
if (this.data.fieldValue === annotationStorage[this.data.id]) {
|
||||
const value = annotationStorage[this.data.id];
|
||||
if (value === this.data.fieldValue || value === undefined) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -1156,7 +1157,6 @@ class WidgetAnnotation extends Annotation {
|
|||
return null;
|
||||
}
|
||||
|
||||
const value = annotationStorage[this.data.id];
|
||||
const bbox = [
|
||||
0,
|
||||
0,
|
||||
|
@ -1222,7 +1222,13 @@ class WidgetAnnotation extends Annotation {
|
|||
return null;
|
||||
}
|
||||
const value = annotationStorage[this.data.id];
|
||||
if (value === undefined) {
|
||||
// The annotation hasn't been rendered so use the appearance
|
||||
return null;
|
||||
}
|
||||
|
||||
if (value === "") {
|
||||
// the field is empty: nothing to render
|
||||
return "";
|
||||
}
|
||||
|
||||
|
@ -1695,7 +1701,16 @@ class ButtonWidgetAnnotation extends WidgetAnnotation {
|
|||
}
|
||||
|
||||
if (annotationStorage) {
|
||||
const value = annotationStorage[this.data.id] || false;
|
||||
const value = annotationStorage[this.data.id];
|
||||
if (value === undefined) {
|
||||
return super.getOperatorList(
|
||||
evaluator,
|
||||
task,
|
||||
renderForms,
|
||||
annotationStorage
|
||||
);
|
||||
}
|
||||
|
||||
let appearance;
|
||||
if (value) {
|
||||
appearance = this.checkedAppearance;
|
||||
|
@ -1741,9 +1756,12 @@ class ButtonWidgetAnnotation extends WidgetAnnotation {
|
|||
}
|
||||
|
||||
async _saveCheckbox(evaluator, task, annotationStorage) {
|
||||
const defaultValue = this.data.fieldValue && this.data.fieldValue !== "Off";
|
||||
const value = annotationStorage[this.data.id];
|
||||
if (value === undefined) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const defaultValue = this.data.fieldValue && this.data.fieldValue !== "Off";
|
||||
if (defaultValue === value) {
|
||||
return null;
|
||||
}
|
||||
|
@ -1780,9 +1798,12 @@ class ButtonWidgetAnnotation extends WidgetAnnotation {
|
|||
}
|
||||
|
||||
async _saveRadioButton(evaluator, task, annotationStorage) {
|
||||
const defaultValue = this.data.fieldValue === this.data.buttonValue;
|
||||
const value = annotationStorage[this.data.id];
|
||||
if (value === undefined) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const defaultValue = this.data.fieldValue === this.data.buttonValue;
|
||||
if (defaultValue === value) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -720,7 +720,7 @@ class ChoiceWidgetAnnotationElement extends WidgetAnnotationElement {
|
|||
// used and the full array of field values is stored.
|
||||
storage.getOrCreateValue(
|
||||
id,
|
||||
this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : null
|
||||
this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : undefined
|
||||
);
|
||||
|
||||
const selectElement = document.createElement("select");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue