webPDF 8: Operation Outline, Part 3: The AnnotationSelection Object Using the `hide` Action as an Example
Minimum Technical Requirements
- Java version: 8
- webPDF version: 8
- wsclient version: 2
The AnnotationSelection Object
Continuation of Operation Outline Part 2.
An AnnotationSelection object is used to select the annotations to be modified. Multiple annotations can be selected for this purpose.
The annotationSelection Object
Several of the ActionTypes defined here modify annotations of the document. Such an annotation is selected through an AnnotationSelection object, shown here using the hide action 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 annotation in the page's annotation directory. Alternatively, the name of the annotation can be specified.
annotationSelection.setIndex(3);
name
The name of the annotation. Alternatively, the index of the annotation can be specified.
annotationSelection.setName("annotationName");
executeNamed ActionType
The PDF standard allows actions to be prepared and stored under a specific name. This action allows them to be executed.
NamedActionType executeNamed = new NamedActionType();
firstPage.getActions().add(executeNamed);
The following parameters and subelements can be selected for an executeNamed action.
namedOperation (default value: "")
The name of the operation to be executed. Additional operations may be defined, but 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 document's form fields 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 should be sent.
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 have not been 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 when 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 when exportFormat has been activated. If the value is set to true, the position of the triggering mouse click is also included in the exported data.
submitForm.setSubmitCoordinates(true);
xfdf (default value: "false")
This value is relevant if submitPDF has not been activated. If it is set to true, the form data is transmitted in XFDF format.
submitForm.setXfdf(true);
includeAppendSaves (default value: "false")
This value is relevant when the form data is transmitted in FDF format. In that case, the export includes incremental changes to the form data.
submitForm.setIncludeAppendSaves(true);
includeAnnotations (default value: "false")
This value is relevant when the form data is transmitted in FDF format. In that 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 is transmitted in PDF format.
submitForm.setSubmitPDF(true);
canonicalFormat (default value: "false")
If this value is set to true, all dates and times are transmitted in a canonical standard format.
submitForm.setCanonicalFormat(true);
excludeNonUserAnnotations (default value: "false")
This value is relevant when the form data is transmitted in FDF format. If this value is set to true, all annotations not set by the user are excluded from transmission.
submitForm.setExcludeNonUserAnnotations(true);
excludeFDFSourceOrTargetFile (default value: "false")
This value is relevant when the form data is transmitted in FDF format. If it is set to true, the target URL is not included in the export data.
submitForm.setExcludeFDFSourceOrTargetFile(true);
embedForm (default value: "false")
This value is relevant when the form data is transmitted in FDF format. If it is set to true, not only the form data itself but the entire document with the embedded form is transmitted.
submitForm.setEmbedForm(true);
The field Object
Selects the form fields that should be submitted or reset for submitForm and resetForm actions.
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 to be selected.
formField.setName("formFieldName");
resetForm ActionType
Resets the content of the selected form fields in 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, the contents of the document's form fields are set to the values defined in the provided 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 specified JavaScript code when the element is selected.
JavaScriptActionType executeJS = new JavaScriptActionType();
firstPage.getActions().add(executeJS);
The following parameters and subelements can be selected for an executeJavaScript action.
jsAction (default value: "")
The JavaScript code to be executed.
executeJS.setJsAction("...");
setOCGState ActionType
Changes the visibility of the selected layer when the element is selected.
SetOCGStateActionType setOCGState = new SetOCGStateActionType();
firstPage.getActions().add(setOCGState);
Next Blog Article on the Webservice Operation Outline
Go to webPDF 8 here: Operation Outline - Part 4 - Additional ActionTypes.