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.
These APIs have different effects on the built-in SDK workflow:
| Goal | API | Effect on default behavior |
|---|---|---|
| Observe a completed annotation creation | CPDFEvent.ANNOTATIONS_CREATED | Does not change default behavior. |
| Replace the Signature, Image, Stamp, Link, or Note creation UI | onAnnotationCreationPrepared | After disabling the corresponding built-in UI, the application must complete or cancel the workflow. |
| Replace the action for an existing Note or Link | onInterceptAnnotationActionCallback | The SDK no longer performs the default edit or navigation action. |
| Replace selected form-field actions | onInterceptWidgetActionCallback | The SDK no longer performs the default action for intercepted field types. |
| Annotation type | Configuration to disable | annotation parameter | Next application action |
|---|---|---|---|
CPDFAnnotationType.SIGNATURE | autoShowSignPicker: false | null | Select an image, then call prepareNextSignature(). |
CPDFAnnotationType.STAMP | autoShowStampPicker: false | null | Select a stamp, then call prepareNextStamp(). |
CPDFAnnotationType.PICTURES | autoShowPicPicker: false | null | Select an image, then call prepareNextImage(). |
CPDFAnnotationType.LINK | autoShowLinkDialog: false | Created CPDFLinkAnnotation | Set action and call _pdfDocument.updateAnnotation(); remove it on cancel. |
CPDFAnnotationType.NOTE | autoShowNoteEditDialog: false | Created CPDFNoteAnnotation | Set content and call _pdfDocument.updateAnnotation(); remove it on cancel. |
const configuration = ComPDFKit.getDefaultConfig({
annotationsConfig: {
autoShowSignPicker: false,
autoShowStampPicker: false,
autoShowPicPicker: false,
autoShowLinkDialog: false,
autoShowNoteEditDialog: false,
},
});Signature, Stamp, and Image annotations have not yet been placed when the callback runs:
await pdfReaderRef.current?.prepareNextSignature(signaturePath);
await pdfReaderRef.current?.prepareNextImage(imagePath);
await pdfReaderRef.current?.prepareNextStamp({
standardStamp: CPDFStandardStamp.APPROVED,
});Link and Note objects already exist when the callback runs. Updating the JavaScript object alone does not persist the change; call updateAnnotation() or removeAnnotation(). See Create Annotations for the complete custom Note confirm/cancel workflow.
Set interceptNoteAction or interceptLinkAction to true in annotationsConfig. The application must then handle Note editing, web links, or page navigation in onInterceptAnnotationActionCallback. Do not enable interception if you only need passive observation.
List only the required CPDFWidgetType values in formsConfig.interceptFormWidgetActions. After changing the returned CPDFWidget, call pdfReaderRef.current?._pdfDocument.updateWidget(widget). Use interceptAllFormWidgetActions: true only when the application implements every form-field behavior.
creationConfig controls continuous creation and automatic selection after interactive creation, separately from this page's creation-dialog callbacks. Disabling automatic selection does not suppress creation events, but it suppresses selection events for the new object. See Annotation and Form Creation Policy.
To handle signature-field taps, add CPDFWidgetType.SIGNATURES_FIELDS to formsConfig.interceptFormWidgetActions and check CPDFSignatureWidget.isSigned in onInterceptWidgetActionCallback. Open signing UI for explicitly unsigned fields, show verification information for signed fields, and read the state again if it is unavailable. Set readerViewConfig.formFieldHighlight: true to highlight form fields.
Certificate signing uses writeSignature(). Certificate information does not belong in the reader configuration. See Create Digital Signatures.