PDF Generation Template Editor
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
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.
const pdfReaderRef = useRef<CPDFReaderView>(null);
<CPDFReaderView
ref={pdfReaderRef}
document={samplePDF}
configuration={ComPDFKit.getDefaultConfig({})}
/>
// 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 |
CPDFSignatureWidget.isSigned is a read-only optional property. true means the field contains a digital signature; false means it is unsigned. Older bridges may omit this property. Treat an absent value as unknown, not unsigned.
When signing, use the page and uuid read from the current document. See Create Digital Signatures.