Skip to content
DemoAPI ReferenceFAQ

PDF Generation Template Editor

Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.

View on GitHub
React Native Guides Access forms

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
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

ClassDescription
CPDFWidgetBase class for all form widgets
CPDFTextWidgetText input field widget
CPDFSignatureWidgetSignature widget
CPDFRadiobuttonWidgetRadio button widget
CPDFPushbuttonWidgetButton widget
CPDFListboxWidgetList box widget
CPDFCheckboxWidgetCheckbox widget
CPDFComboboxWidgetCombo box widget

Read Signature-Field State ​

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.