Pdf - PdfSubmitFormAction

18 Nov 202620 minutes to read

Represents an action that submits form data to a specified URL.

// Create a new PDF document
let document: PdfDocument = new PdfDocument();
let page: PdfPage = document.addPage();
// Create a text box field
let textField: PdfTextBoxField = new PdfTextBoxField(
    page, 'Name', { x: 20, y: 20, width: 150, height: 30 }
);
document.form.add(textField);
// Create a submit-form action
let action: PdfSubmitFormAction = new PdfSubmitFormAction('https://www.example.com/submit');
action.fields = [textField];
action.include = true;
action.httpMethod = HttpMethod.Post;
action.dataFormat = PdfSubmitDataFormat.Fdf;
// Create a button and assign the action
let button: PdfButtonField = new PdfButtonField(
    page, 'SubmitForm', { x: 20, y: 70, width: 120, height: 30 }
);
button.text = 'Submit form';
button.actions.mouseUp = action;
document.form.add(button);
// Save and destroy the document
document.save('output.pdf');
document.destroy();

Properties

Get canonicalDateTimeFormat boolean

Gets whether date and time values are submitted in canonical format.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
let button: PdfButtonField = document.form.fieldAt(1) as PdfButtonField;
// Get the canonical date and time format setting
let action: PdfSubmitFormAction = button.actions.mouseUp as PdfSubmitFormAction;
let canonicalDateTimeFormat: boolean = action.canonicalDateTimeFormat;
// Save and destroy the document
document.save('output.pdf');
document.destroy();

Set canonicalDateTimeFormat void

Sets whether date and time values are submitted in canonical format.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
let button: PdfButtonField = document.form.fieldAt(1) as PdfButtonField;
// Enable canonical date and time formatting
let action: PdfSubmitFormAction = button.actions.mouseUp as PdfSubmitFormAction;
action.canonicalDateTimeFormat = true;
// Save and destroy the document
document.save('output.pdf');
document.destroy();
Parameter Type Description
value boolean true to use canonical formatting; otherwise, false.

Get dataFormat PdfSubmitDataFormat

Gets the format used to submit the form data.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
let button: PdfButtonField = document.form.fieldAt(1) as PdfButtonField;
// Get the submitted data format
let action: PdfSubmitFormAction = button.actions.mouseUp as PdfSubmitFormAction;
let dataFormat: PdfSubmitDataFormat = action.dataFormat;
// Save and destroy the document
document.save('output.pdf');
document.destroy();

Set dataFormat void

Sets the format used to submit the form data.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
let button: PdfButtonField = document.form.fieldAt(1) as PdfButtonField;
// Set the submitted data format
let action: PdfSubmitFormAction = button.actions.mouseUp as PdfSubmitFormAction;
action.dataFormat = PdfSubmitDataFormat.Xfdf;
// Save and destroy the document
document.save('output.pdf');
document.destroy();
Parameter Type Description
value PdfSubmitDataFormat The format used to submit the form data.

Get embedForm boolean

Gets whether the form is embedded in the submitted data.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
let button: PdfButtonField = document.form.fieldAt(1) as PdfButtonField;
// Get the embedded-form setting
let action: PdfSubmitFormAction = button.actions.mouseUp as PdfSubmitFormAction;
let embedForm: boolean = action.embedForm;
// Save and destroy the document
document.save('output.pdf');
document.destroy();

Set embedForm void

Sets whether the form is embedded in the submitted data.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
let button: PdfButtonField = document.form.fieldAt(1) as PdfButtonField;
// Embed the form in the submitted data
let action: PdfSubmitFormAction = button.actions.mouseUp as PdfSubmitFormAction;
action.embedForm = true;
// Save and destroy the document
document.save('output.pdf');
document.destroy();
Parameter Type Description
value boolean true to embed the form; otherwise, false.

Get excludeNonUserAnnotations boolean

Gets whether non-user annotations are excluded from the submitted data.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
let button: PdfButtonField = document.form.fieldAt(1) as PdfButtonField;
// Get the non-user annotation exclusion setting
let action: PdfSubmitFormAction = button.actions.mouseUp as PdfSubmitFormAction;
let excludeNonUserAnnotations: boolean = action.excludeNonUserAnnotations;
// Save and destroy the document
document.save('output.pdf');
document.destroy();

Set excludeNonUserAnnotations void

Sets whether non-user annotations are excluded from the submitted data.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
let button: PdfButtonField = document.form.fieldAt(1) as PdfButtonField;
// Exclude non-user annotations
let action: PdfSubmitFormAction = button.actions.mouseUp as PdfSubmitFormAction;
action.excludeNonUserAnnotations = true;
// Save and destroy the document
document.save('output.pdf');
document.destroy();
Parameter Type Description
value boolean true to exclude non-user annotations; otherwise, false.

Get fields PdfField[]

Gets the form fields associated with the action.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Get the reset button field
let button: PdfButtonField = document.form.fieldAt(1) as PdfButtonField;
// Get the reset-form action
let action: PdfResetFormAction = button.actions.mouseUp as PdfResetFormAction;
// Get the fields associated with the action
let fields: PdfField[] = action.fields;
// Save and destroy the document
document.save('output.pdf');
document.destroy();

Set fields void

Sets the form fields associated with the action.

// Create a new PDF document
let document: PdfDocument = new PdfDocument();
let page: PdfPage = document.addPage();
// Create form fields
let nameField: PdfTextBoxField = new PdfTextBoxField(
    page, 'Name', { x: 20, y: 20, width: 150, height: 30 }
);
let cityField: PdfTextBoxField = new PdfTextBoxField(
    page, 'City', { x: 20, y: 60, width: 150, height: 30 }
);
document.form.add(nameField);
document.form.add(cityField);
// Create a reset-form action and set the target fields
let action: PdfResetFormAction = new PdfResetFormAction();
action.fields = [nameField, cityField];
action.include = true;
// Create a button and assign the action
let button: PdfButtonField = new PdfButtonField(
    page, 'ResetForm', { x: 20, y: 110, width: 120, height: 30 }
);
button.actions.mouseUp = action;
document.form.add(button);
// Save and destroy the document
document.save('output.pdf');
document.destroy();
Parameter Type Description
value PdfField[] The form fields to associate with the action.

Get httpMethod HttpMethod

Gets the HTTP method used to submit the form data.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
let button: PdfButtonField = document.form.fieldAt(1) as PdfButtonField;
// Get the submit-form action and HTTP method
let action: PdfSubmitFormAction = button.actions.mouseUp as PdfSubmitFormAction;
let httpMethod: HttpMethod = action.httpMethod;
// Save and destroy the document
document.save('output.pdf');
document.destroy();

Set httpMethod void

Sets the HTTP method used to submit the form data.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
let button: PdfButtonField = document.form.fieldAt(1) as PdfButtonField;
// Get the submit-form action and set the HTTP method
let action: PdfSubmitFormAction = button.actions.mouseUp as PdfSubmitFormAction;
action.httpMethod = HttpMethod.Post;
// Save and destroy the document
document.save('output.pdf');
document.destroy();
Parameter Type Description
value HttpMethod The HTTP method used to submit the form data.

Get include boolean

Gets whether the specified form fields are included when the action is executed.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Get the reset button field
let button: PdfButtonField = document.form.fieldAt(1) as PdfButtonField;
// Get the reset-form action
let action: PdfResetFormAction = button.actions.mouseUp as PdfResetFormAction;
// Get whether the specified fields are included
let include: boolean = action.include;
// Save and destroy the document
document.save('output.pdf');
document.destroy();

Set include void

Sets whether the specified form fields are included when the action is executed.

// Create a new PDF document
let document: PdfDocument = new PdfDocument();
let page: PdfPage = document.addPage();
// Create a text box field
let textField: PdfTextBoxField = new PdfTextBoxField(
    page, 'Name', { x: 20, y: 20, width: 150, height: 30 }
);
document.form.add(textField);
// Create and configure a reset-form action
let action: PdfResetFormAction = new PdfResetFormAction();
action.fields = [textField];
action.include = true;
// Create a button and assign the action
let button: PdfButtonField = new PdfButtonField(
    page, 'ResetForm', { x: 20, y: 70, width: 120, height: 30 }
);
button.actions.mouseUp = action;
document.form.add(button);
// Save and destroy the document
document.save('output.pdf');
document.destroy();
Parameter Type Description
value boolean true to include the specified fields; otherwise, false.

Get includeAnnotations boolean

Gets whether annotations are included in the submitted data.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
let button: PdfButtonField = document.form.fieldAt(1) as PdfButtonField;
// Get the annotation inclusion setting
let action: PdfSubmitFormAction = button.actions.mouseUp as PdfSubmitFormAction;
let includeAnnotations: boolean = action.includeAnnotations;
// Save and destroy the document
document.save('output.pdf');
document.destroy();

Set includeAnnotations void

Sets whether annotations are included in the submitted data.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
let button: PdfButtonField = document.form.fieldAt(1) as PdfButtonField;
// Include annotations
let action: PdfSubmitFormAction = button.actions.mouseUp as PdfSubmitFormAction;
action.includeAnnotations = true;
// Save and destroy the document
document.save('output.pdf');
document.destroy();
Parameter Type Description
value boolean true to include annotations; otherwise, false.

Get includeIncrementalUpdates boolean

Gets whether incremental updates are included in the submitted data.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
let button: PdfButtonField = document.form.fieldAt(1) as PdfButtonField;
// Get the incremental-update inclusion setting
let action: PdfSubmitFormAction = button.actions.mouseUp as PdfSubmitFormAction;
let includeIncrementalUpdates: boolean = action.includeIncrementalUpdates;
// Save and destroy the document
document.save('output.pdf');
document.destroy();

Set includeIncrementalUpdates void

Sets whether incremental updates are included in the submitted data.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
let button: PdfButtonField = document.form.fieldAt(1) as PdfButtonField;
// Include incremental updates
let action: PdfSubmitFormAction = button.actions.mouseUp as PdfSubmitFormAction;
action.includeIncrementalUpdates = true;
// Save and destroy the document
document.save('output.pdf');
document.destroy();
Parameter Type Description
value boolean true to include incremental updates; otherwise, false.

Get includeNoValueFields boolean

Gets whether fields without values are included in the submitted form data.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
let button: PdfButtonField = document.form.fieldAt(1) as PdfButtonField;
// Get the empty-field inclusion setting
let action: PdfSubmitFormAction = button.actions.mouseUp as PdfSubmitFormAction;
let includeNoValueFields: boolean = action.includeNoValueFields;
// Save and destroy the document
document.save('output.pdf');
document.destroy();

Set includeNoValueFields void

Sets whether fields without values are included in the submitted form data.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
let button: PdfButtonField = document.form.fieldAt(1) as PdfButtonField;
// Include fields without values
let action: PdfSubmitFormAction = button.actions.mouseUp as PdfSubmitFormAction;
action.includeNoValueFields = true;
// Save and destroy the document
document.save('output.pdf');
document.destroy();
Parameter Type Description
value boolean true to include fields without values; otherwise, false.

Get next PdfAction

Get the next action to be performed after the action represented by this instance.

Set next void

Set the next action to be performed after the action represented by this instance.

Parameter Type Description
value PdfAction The next action to be executed.

Get submitCoordinates boolean

Gets whether mouse coordinates are included in the submitted form data.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
let button: PdfButtonField = document.form.fieldAt(1) as PdfButtonField;
// Get the coordinate submission setting
let action: PdfSubmitFormAction = button.actions.mouseUp as PdfSubmitFormAction;
let submitCoordinates: boolean = action.submitCoordinates;
// Save and destroy the document
document.save('output.pdf');
document.destroy();

Set submitCoordinates void

Sets whether mouse coordinates are included in the submitted form data.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
let button: PdfButtonField = document.form.fieldAt(1) as PdfButtonField;
// Enable coordinate submission
let action: PdfSubmitFormAction = button.actions.mouseUp as PdfSubmitFormAction;
action.submitCoordinates = true;
// Save and destroy the document
document.save('output.pdf');
document.destroy();
Parameter Type Description
value boolean true to submit mouse coordinates; otherwise, false.

Get url string

Gets the URL to which the form data is submitted.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
let button: PdfButtonField = document.form.fieldAt(1) as PdfButtonField;
// Get the submit-form action and URL
let action: PdfSubmitFormAction = button.actions.mouseUp as PdfSubmitFormAction;
let url: string = action.url;
// Save and destroy the document
document.save('output.pdf');
document.destroy();

Set url void

Sets the URL to which the form data is submitted.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
let button: PdfButtonField = document.form.fieldAt(1) as PdfButtonField;
// Get the submit-form action and set the URL
let action: PdfSubmitFormAction = button.actions.mouseUp as PdfSubmitFormAction;
action.url = 'https://www.example.com/updated';
// Save and destroy the document
document.save('output.pdf');
document.destroy();
Parameter Type Description
value string The URL to which the form data is submitted.