webPDF 8: Operation Outline – Part 3:
Minimum technical requirements
- Java version: 8
- webPDF version: 8
- wsclient version: 2
To the AnnotationSelection object
Continuation of part 2:
An AnnotationSelection
object is used to select the modified annotations. Several annotations can be selected.
The “annotationSelection” object
Several of the ActionTypes
defined here modify annotations of the document. An AnnotationSelection
object is used to select such an annotation. (Here the hide
action is used as an example.)
AnnotationSelectionType annotationSelection = new AnnotationSelectionType(); hideAction.getAnnotation().add(annotationSelection);
The following parameters can be set on the annotationSelection
object:
page (default value: “1”)
The number of the page on which the annotation is located.
annotationSelection.setPage(2);
index
The index of the annotations in the annotation directory of the page (alternatively, the name of the annotation can also be specified).
annotationSelection.setIndex(3);
name
The name of the annotation (alternatively, the index of the annotation can also be specified).
annotationSelection.setName("annotationName");
executeNamed-ActionType
The PDF standard offers the possibility to prepare actions and store them under a certain name. This action allows their execution.
NamedActionType executeNamed = new NamedActionType(); firstPage.getActions().add(executeNamed);
The following parameters and subelements can be selected for a executeNamed
action:
namedOperation (default value: “”)
The name of the operation to be performed. Further operations can be defined. The PDF standard supports the following names by default:
- NextPage = Jump to the next page.
- PrevPage = Jump to the previous page.
- FirstPage = Jump to the first page.
- LastPage = Jump to the last page.
executeNamed.setNamedOperation("FirstPage");
submitForm-ActionType
Transfers the contents of the form fields of the document to a given URL when the element is selected. (Form fields to be exported are selected using field
objects.)
SubmitFormActionType submitForm = new SubmitFormActionType(); firstPage.getActions().add(submitForm);
The following parameters and subelements can be selected for a submitForm
Action:
url (default value: “”)
The URL to which the form data is to be transferred.
submitForm.setUrl("https://www.softvision.de");
exclude (default value: “false”)
If this value is set to true
, all form fields except the selected ones are exported.
submitForm.setExclude(true);
includeNoValueFields (default value: “false”)
If this value is set to true
, form fields whose values were not set are also exported.
submitForm.setIncludeNoValueFields(true);
exportFormat (default value: “false”)
If this value is set to true
and neither submitPDF nor xfdf is activated, the form data is exported in HTML format – otherwise it is exported in fdf format.
submitForm.setExportFormat(true);
getMethod (default value: false)
This value is relevant if exportFormat has been activated. If the value is set to true
, the form is transmitted using an http GET method, otherwise using an http POST method.
submitForm.setGetMethod(true);
submitCoordinates (default value: “false”)
This value is relevant if exportFormat has been activated. If the value is set to true
, the position of the triggering mouse click is also transmitted in the exported data.
submitForm.setSubmitCoordinates(true);
xfdf (default value: “false”)
This value is relevant if submitPDF has not been activated. If the value is set to true
, the form data is transmitted in XFDF format.
submitForm.setXfdf(true);
includeAppendSaves (default value: “false”)
This value is relevant if the form data is transmitted in fdf format. In this case, the export contains incremental changes to the form data.
submitForm.setIncludeAppendSaves(true);
includeAnnotations (default value: “false”)
This value is relevant if the form data is transmitted in fdf format. In this case, the export also contains all markup annotations of the document.
submitForm.setIncludeAnnotations(true);
submitPDF (default value: “false”)
If this value is set to true
, the form will be sent in pdf format.
submitForm.setSubmitPDF(true);
canonicalFormat (default value: “false”)
If this value is set to true
, all data and times are transmitted in a canonical standard format.
submitForm.setCanonicalFormat(true);
excludeNonUserAnnotations (default value: “false”)
This value is relevant if the form data is transmitted in fdf format. If this value is set to true
, all annotations that were not set by the user will not be transmitted.
submitForm.setExcludeNonUserAnnotations(true);
excludeFDFSourceOrTargetFile (default value: “false”)
This value is relevant if the form data is transmitted in fdf format. If this value is set to true
, the target URL will not be contained in the export data.
submitForm.setExcludeFDFSourceOrTargetFile(true);
embedForm (default value: “false”)
This value is relevant if the form data is transmitted in fdf format. If this value is set to true
, not only the form data itself is transferred, but also the entire document with the embedded form.
submitForm.setExcludeFDFSourceOrTargetFile(true);
The field object
For submitForm
and resetForm
actions, selects the form fields to submit or reset.
FormFieldSelectionType formField = new FormFieldSelectionType(); submitForm.getField().add(formField);
The following parameters and subelements can be selected for a field object:
name (default value: “”)
The name of the form field you want to select.
formField.setName("formFieldName");
resetForm-ActionType
Resets the contents of the selected form fields of the document to their initial values when the element is selected. (Form fields to be changed are selected using field objects.)
ResetFormActionType resetForm = new ResetFormActionType(); firstPage.getActions().add(resetForm);
The following parameters and subelements can be selected for a resetForm
Action:
exclude (default value: “false”)
If this value is set to true
, all form fields except the selected ones are reset.
resetForm.setExclude(true);
importData-ActionType
When the element is selected, sets the contents of the form fields of the document to the values defined in the given schema. A fileSpecification object is used to select the schema file.
ImportDataActionType importData = new ImportDataActionType(); firstPage.getActions().add(importData); FileSpecificationType fileSpecification = new FileSpecificationType(); importData.setFile(fileSpecification);
executeJavaScript-ActionType
Executes the given JavaScript code when the element is selected.
JavaScriptActionType executeJS = new JavaScriptActionType(); firstPage.getActions().add(executeJS);
The following parameters and subelements can be selected for a executeJavaScript
action:
jsAction (default value: “”)
If this value is set to true
, all form fields except the selected ones are reset.
executeJS.setJsAction("...");
setOCGState-ActionType
Changes the visibility of the selected layer when the element is selected.
SetOCGStateActionType setOCGState = new SetOCGStateActionType(); firstPage.getActions().add(setOCGState);
Click here to go to webPDF 8: Operation Outline – Part 4 – Introducing more ActionTypes