webPDF 8: Operation Outline, Part 2: Additional ActionTypes
Minimum Technical Requirements
- Java version: 8
- webPDF version: 8
- wsclient version: 2
Additional ActionTypes
Continuation of Operation Outline Part 1.
fitRectangle Destination
Jumps to a selected page and fits the selected rectangular page area into the view.
FitRectangleDestinationType fitRectangleDestination = new FitRectangleDestinationType();
goTo.setDestination(fitRectangleDestination);
The following parameters can be set for a fitRectangleDestination.
page (default value: "1")
Defines the page to jump to.
fitRectangleDestination.setPage(1);
leftOffset (default value: "0")
Defines the distance between the view and the left page margin.
fitRectangleDestination.setLeftOffset(15);
bottomOffset (default value: "0")
Defines the distance between the view and the bottom page margin.
fitRectangleDestination.setBottomOffset(30);
rightOffset (default value: "0")
Defines the distance between the view and the right page margin.
fitRectangleDestination.setRightOffset(12);
topOffset (default value: "0")
Defines the distance between the view and the top page margin.
fitRectangleDestination.setTopOffset(10);
metrics (default value: "px")
Defines the unit in which the offsets are specified. Possible values:
MM= MillimetersPX= Pixels
fitRectangleDestination.setMetrics(MetricsType.MM);
fitBoundingBox Destination
Jumps to a selected page and fits its content area into the view.
FitBoundingBoxDestinationType fitBoundingBoxDestination = new FitBoundingBoxDestinationType();
goTo.setDestination(fitBoundingBoxDestination);
The following parameters can be set for a fitBoundingBoxDestination.
page (default value: "1")
Defines the page to jump to.
fitBoundingBoxDestination.setPage(1);
fitBoundingBoxWidth Destination
Jumps to a selected page and fits the width of its content area into the view.
FitBoundingBoxWidthDestinationType fitBoundingBoxWidthDestination = new FitBoundingBoxWidthDestinationType();
goTo.setDestination(fitBoundingBoxWidthDestination);
The following parameters can be set for a fitBoundingBoxWidthDestination.
page (default value: "1")
Defines the page to jump to.
fitBoundingBoxWidthDestination.setPage(1);
topOffset (default value: "0")
Defines the distance between the view and the top page margin.
fitBoundingBoxWidthDestination.setTopOffset(10);
metrics (default value: "px")
Defines the unit in which the offsets are specified. Possible values:
MM= MillimetersPX= Pixels
fitBoundingBoxWidthDestination.setMetrics(MetricsType.MM);
named Destination
Jumps to the named destination with the specified name.
NamedDestinationType namedDestination = new NamedDestinationType();
goTo.setDestination(namedDestination);
The following parameters can be set for a namedDestination.
name (default value: "View1")
Defines the name of the destination to jump to.
namedDestination.setName("jumpmark1");
launchApplication ActionType
Selects an application to be executed when the element in the outline is selected.
LaunchApplicationActionType launchApp = new LaunchApplicationActionType();
firstPage.getActions().add(launchApp);
The following parameters and subelements can be selected for a LaunchApplication action.
newWindow (default value: "userPreference")
Selects the window in which the application or document should be opened.
USER_PREFERENCE= Use the variant configured in the displaying application.NEW_WINDOW= Always use a new window.SAME_WINDOW= Use, if possible, the currently open window of the displaying application.
launchApp.setNewWindow(OpenModeType.SAME_WINDOW);
The launchParameters/windows Object
Selects arguments for executing the application.
The parameters passed here are platform-specific. At present, however, only argument passing for Windows applications is supported, so a launchParameters object should always receive a windows object.
LaunchParameterType launchParameters = new LaunchParameterType();
launchApp.setLaunchParameters(launchParameters);
LaunchParameterType.Windows windowsArgs = new LaunchParameterType.Windows();
launchParameters.setWindows(windowsArgs);
The following parameters and subelements can be selected for a windows object.
fileName (default value: "")
A Windows file name in standard Windows path notation. Backslashes must be escaped as usual. This file name is passed to the application as the file to be opened.
windowsArgs.setFileName("aDocument.xyz");
directory (default value: "")
The Windows base path from which navigation should begin, in standard DOS syntax.
windowsArgs.setDirectory("C:\\aPath\\");
operation (default value: "open")
Selects the default operation with which the selected document should be processed.
OPEN= Open the document.PRINT= Print the document.
windowsArgs.setOperation(ApplicationOperationType.OPEN);
arguments (default value: "")
The arguments that should be passed to the application.
windowsArgs.setArguments("args");
The fileSpecification Object
Selects a document or application that should be used for an ActionType, shown here using a launchApplication object as an example.
FileSpecificationType file = new FileSpecificationType();
launchApp.setApplicationPath(file);
The following parameters and subelements can be selected for a fileSpecification object.
volatileFile (default value: "false")
If this value is set to true, the opened document is considered volatile and must not be cached.
file.setVolatileFile(true);
description (default value: "")
A description of the application to be opened.
file.setDescription("description");
resourceURL (default value: "")
The path or URL of the application or document to be opened. Platform-specific path separators may be used, but if possible only slashes (/) should be used.
file.setResourceURL("C:/aPath/toAn/Executable.exe");
resolveURI ActionType
Opens the specified URL when the element in the outline is selected.
URIActionType uri = new URIActionType();
firstPage.getActions().add(uri);
The following parameters and subelements can be selected for a uri action.
uri (default value: "")
The URI to be displayed.
uri.setUri("http://www.softvision.de");
playSound ActionType
Plays an audio file when the element in the outline is selected.
SoundActionType sound = new SoundActionType();
firstPage.getActions().add(sound);
The following parameters and subelements can be selected for a sound action.
sound (default value: "")
The audio data to be played. The provided data must be self-contained and include all information necessary for playback. Supported audio formats include AIFF, AIFF-C, RIFF (*.wav), and snd (*.au).
sound.setSound(new byte[0]);
volume (default value: "100")
A percentage value between 100 and -100 that configures playback volume.
sound.setVolume(50);
synchronous (default value: "false")
If this value is set to true, further user interaction with the document is blocked during playback.
sound.setSynchronous(true);
repeat (default value: "false")
If this value is set to true, playback is repeated endlessly.
sound.setRepeat(true);
mix (default value: "false")
If this value is set to true, other audio tracks in the document can be played simultaneously. If it is set to false, playback of other audio tracks is stopped before playback starts.
sound.setMix(true);
samplingRate (default value: "8000")
The sampling rate of the audio file.
sound.setSamplingRate(8000);
soundChannels (default value: "1")
The number of audio channels available for playback.
sound.setSoundChannels(2);
sampleSize (default value: "8")
The number of bits per sample, per audio channel.
sound.setSampleSize(8);
encoding (default value: "Raw")
The data encoding. Possible values are Raw, Signed, muLaw, and ALaw.
sound.setEncoding(AudioEncodingType.MU_LAW);
hide ActionType
Changes the visibility of the selected annotations when the element in the outline is selected.
HideActionType hide = new HideActionType();
firstPage.getActions().add(hide);
The following parameters and subelements can be selected for a hide action.
hide (default value: "true")
Defines the visibility to be set for the annotation.
hide.setHide(false);
Further Parts of Operation Outline
The information on the Operation Outline webservice has been split into four parts due to its length. Go to webPDF 8 here: Operation Outline - Part 3 - The AnnotationSelection Object Using the hide Action as an Example.
More general information about webPDF 8 can be found here.