webPDF 8: Operation Outline – Part 2:

Minimum technical requirements

  • Java version: 8
  • webPDF version: 8
  • wsclient version: 2

Presentation of further ActionTypes

Continuation of part 1 about operation outline:

fitRectangle-Destination

Jumps to a selected page and fits the selected rectangular page section into the view.

FitRectangleDestinationType fitRectangleDestination = new FitRectangleDestinationType();
goTo.setDestination(fitHeightDestination);

The following parameters can be set for a fitRectangleDestination:

page (default value: “1”)

Specifies the page to jump to.

fitRectangleDestination.setPage(1);

leftOffset (default value: “0”)

Sets the distance between the view and the left margin of the page.

fitRectangleDestination.setLeftOffset(15);

bottomOffset (default value: “0”)

Sets the distance between the view and the bottom of the page.

fitRectangleDestination.setBottomOffset(30);

rightOffset (default value: “0”)

Sets the distance between the view and the right margin of the page.

fitRectangleDestination.setRightOffset(12);

topOffset (default value: “0”)

Sets the distance between the view and the top of the page.

fitRectangleDestination.setTopOffset(10);

metrics (default value: “px”)

Defines the unit of measurement in which the distances are specified. Possible values:

  • MM = Millimetre
  • PX = Pixel
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 fitBoundingBoxWidthDestination:

page (default value: “1”)

Specifies the page to jump to.

fitBoundingBoxDestination.setPage(1);

fitWidth destination

Jumps to a selected page and fits the width of its content area into the view.

FitWidthDestinationType fitBoundingBoxWidthDestination = new FitBoundingBoxWidthDestinationType();
goTo.setDestination(fitBoundingBoxWidthDestination);

The following parameters can be set for a fitBoundingBoxDestination:

page (default value: “1”)

Specifies the page to jump to.

FitBoundingBoxWidthDestination.setPage(1);

topOffset (default value: “0”)

Sets the distance between the view and the top of the page.

fitBoundingBoxWidthDestination.setTopOffset(10);

metrics (default value: “px”)

Defines the unit of measurement in which the distances are specified. Possible values:

  • MM = Millimetre
  • PX = Pixel
fitBoundingBoxWidthDestination.setMetrics(MetricsType.MM);

named destination

Jumps to the marker with the given name.

NamedDestinationType namedDestination = new NamedDestinationType();
goTo.setDestination(namedDestination);

The following parameters can be set for a namedDestination:

name (default value: “View1”)

Specifies the name of the label to jump to.

namedDestination.setName("jumpmark1");

launchApplication-ActionType

Selects an application that is to be executed when the element in the content structure 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/document is to 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 opened window of the displaying application.
launchApp.setNewWindow(OpenModeType.SAME_WINDOW);

The “launchParameters/windows” object

Selects arguments for the execution of the application.

The parameters passed here are platform-specific, but currently only argument passing for Windows applications is supported, so a launchParameters object should always be passed 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 a file to be opened.

windowsArgs.setFileName("aDocument.xyz");

directory (default value: “”)

The Windows base path from which you want to navigate in standard DOS syntax.

windowsArgs.setDirectory("C:\\aPath\\");

operation (default value: “open”)

Selects the default operation with which the selected document is to be processed.

  • OPEN = Open the document.
  • PRINT = Print the document.
windowsArgs.setOperation(ApplicationOperationType.OPEN);

arguments (default value: “”)

The arguments to be passed to the application.

windowsArgs.setArguments("args");

The fileSpecification Object

Selects a document or application to be used for an ActionType. (This is an example of a launchApplication object.

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 open document is a document that is subject to constant change and must not be cached.

application.setVolatileFile(true);

description (default value: “”)

A description of the application to be opened.

fileSpecificationType.setDescription("description");

resourceURL (default value: “”)

The path or URL to the application/document to be opened. Platform-specific characters can be used as path separators, but only slashes (/) should be used if possible.

fileSpecificationType.setResourceURL("C:/aPath/toAn/Executable.exe");

resolveURI ActionType

Opens the specified URL when the element is selected in the table of contents.

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.

uriAction.setUri("http://www.softvision.de");

playSound-ActionType

Plays an audio file when the item in the Contents pane is selected.

SoundActionType sound = new SoundActionType();
firstPage.getActions().add(sound);

The following parameters and sub-elements can be selected for a sound action:

sound (default value: “”)

The audio data to be played back. The data transmitted must be absolutely independent and contain all the information necessary for its reproduction. The audio formats AIFF, AIFF-C, RIFF (*.wav), snd(*.au) are supported, for example.

soundAction.setSound(new byte[0]);

volume (default value: “100”)

A percentage value between 100 and -100 that configures the playback volume.

soundAction.setVolume(50);

synchronous (default value: “false”)

If this value is set to true, further user interactions with the document are prevented during playback.

soundAction.setSynchronous(true);

repeat (default value: “false”)

If this value is set to true, playback is repeated endlessly.

soundAction.setRepeat(true);

mix (default value: “false”)

If this value is set to true, the simultaneous playback of other audio tracks of the document is possible – if it is set to false, the playback of other audio tracks is stopped before playback.

soundAction.setMix(true);

samplingRate (default value: “8000”)

The sampling rate of the audio file.

soundAction.setSampleSize(8000);

soundChannels (default value: “1”)

The number of audio channels that can be used for playback.

soundAction.setSoundChannels(2);

sampleSize (default value: “8”)

The number of bits, per sample, per audio channel.

soundAction.setSampleSize(8);

encoding (default value: “Raw”)

The encoding of the data. Possible values are: Raw, Signed, muLaw, ALaw

soundAction.setEncoding(AudioEncodingType.MU_LAW);

hide ActionType

Changes the visibility of the selected annotations when selecting the element in the table of contents.

HideActionType hide = new HideActionType();
firstPage.getActions().add(hide);

The following parameters and subelements can be selected for a hide action:

hide (default value: “true”)

The visibility of the annotation to be set.

hide.setHide(false);

Further parts to Operation Outline

The information on the Operation Outline webservice has been divided into 4 parts due to its length. Click here for webPDF 8: Operation Outline – Part 3 – To the AnnotationSelection object using the hide action as an example…

More general information about webPDF 8 can be found here.