Guides
Access Forms
Retrieves all form widgets on the current page.
This method fetches all form widgets present on the current page of the PDF document and returns a list of corresponding CPDFWidget instances.
tsx
// Get the total number of pages in the PDF document
const pageCount = await pdfReaderRef!.current!._pdfDocument.getPageCount();
let allWidgets: CPDFWidget[] = [];
for (let i = 0; i < pageCount1; i++) {
// Retrieve the page object for the corresponding page number
const page = pdfReaderRef?.current?._pdfDocument.pageAtIndex(i);
// Get all forms on the page.
const widgets = await page?.getWidgets();
if (widgets) {
allWidgets = allWidgets.concat(widgets);
}
}
Related Widgets
Class | Description |
---|---|
CPDFWidget | Base class for all form widgets |
CPDFTextWidget | Text input field widget |
CPDFSignatureWidget | Signature widget |
CPDFRadiobuttonWidget | Radio button widget |
CPDFPushbuttonWidget | Button widget |
CPDFListboxWidget | List box widget |
CPDFCheckboxWidget | Checkbox widget |
CPDFComboboxWidget | Combo box widget |