Guides
Highlight Form Fields and Hyperlinks
You can use the API provided by CPDFConfiguration
or CPDFReaderView
to highlight form fields and hyperlink annotations in the current document.
Highlighting PDF form fields helps users quickly locate and fill out forms, significantly improving efficiency in scenarios involving a lot of form filling.
The hyperlink highlighting feature allows users to add hyperlinks to key information in the PDF document, helping others quickly locate and understand the information. This not only improves the readability of the PDF document but also enhances its interactivity.
Here’s an example of how to highlight form fields and hyperlinks:
tsx
const pdfReaderRef = useRef<CPDFReaderView>(null);
<CPDFReaderView
ref={pdfReaderRef}
document={samplePDF}
onPageChanged={onPageChanged}
saveDocument={saveDocument}
configuration={ComPDFKit.getDefaultConfig({
readerViewConfig: {
formFieldHighlight: true,
linkHighlight: true
}
})} />
Use the provided API to highlight hyperlink annotations and form fields:
tsx
/// Enable hyperlink highlighting.
await pdfReaderRef.current?.setLinkHighlight(true);
/// Enable form field highlighting.
await pdfReaderRef.current?.setFormFieldHighlight(true);