Skip to content

Commit

Permalink
Have Fields.addToPage functions use new page option.
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-trefethen committed Oct 2, 2021
1 parent 44ca0bc commit 1cb3e76
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/api/form/PDFButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ export default class PDFButton extends PDFField {
rotate: options?.rotate ?? degrees(0),
caption: text,
hidden: options?.hidden,
page: page.ref,
});
const widgetRef = this.doc.context.register(widget.dict);

Expand All @@ -181,7 +182,6 @@ export default class PDFButton extends PDFField {

// Add widget to the given page
page.node.addAnnot(widgetRef);
this.updateWidgetPageReference(widget, page.ref);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/api/form/PDFCheckBox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ export default class PDFCheckBox extends PDFField {
borderWidth: options.borderWidth ?? 0,
rotate: options.rotate ?? degrees(0),
hidden: options.hidden,
page: page.ref,
});
const widgetRef = this.doc.context.register(widget.dict);

Expand All @@ -182,7 +183,6 @@ export default class PDFCheckBox extends PDFField {

// Add widget to the given page
page.node.addAnnot(widgetRef);
this.updateWidgetPageReference(widget, page.ref);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/api/form/PDFDropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@ export default class PDFDropdown extends PDFField {
borderWidth: options.borderWidth ?? 0,
rotate: options.rotate ?? degrees(0),
hidden: options.hidden,
page: page.ref,
});
const widgetRef = this.doc.context.register(widget.dict);

Expand All @@ -561,7 +562,6 @@ export default class PDFDropdown extends PDFField {

// Add widget to the given page
page.node.addAnnot(widgetRef);
this.updateWidgetPageReference(widget, page.ref);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/api/form/PDFOptionList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ export default class PDFOptionList extends PDFField {
borderWidth: options.borderWidth ?? 0,
rotate: options.rotate ?? degrees(0),
hidden: options.hidden,
page: page.ref,
});
const widgetRef = this.doc.context.register(widget.dict);

Expand All @@ -480,7 +481,6 @@ export default class PDFOptionList extends PDFField {

// Add widget to the given page
page.node.addAnnot(widgetRef);
this.updateWidgetPageReference(widget, page.ref);
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/api/form/PDFRadioGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ export default class PDFRadioGroup extends PDFField {
borderWidth: options?.borderWidth ?? 1,
rotate: options?.rotate ?? degrees(0),
hidden: options?.hidden,
page: page.ref,
});
const widgetRef = this.doc.context.register(widget.dict);

Expand Down
2 changes: 1 addition & 1 deletion src/api/form/PDFTextField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,7 @@ export default class PDFTextField extends PDFField {
borderWidth: options.borderWidth ?? 0,
rotate: options.rotate ?? degrees(0),
hidden: options.hidden,
page: page.ref,
});
const widgetRef = this.doc.context.register(widget.dict);

Expand All @@ -742,7 +743,6 @@ export default class PDFTextField extends PDFField {

// Add widget to the given page
page.node.addAnnot(widgetRef);
this.updateWidgetPageReference(widget, page.ref);
}

/**
Expand Down

0 comments on commit 1cb3e76

Please sign in to comment.