webPDF 8: Operation Outline – Part 4:

Minimum technical requirements

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

Presentation of further ActionTypes

Continuation of part 3:

The following parameters and subelements can be selected for a setOCGState Action:

The “layerState” object

This object selects layers of the document and determines the logic according to which the layer visibility is to be changed.

SetOCGStateActionType.LayerState layerState = new SetOCGStateActionType.LayerState();
setOCGState.getLayerState().add(layerState);

Am layerState Objekt lassen sich folgende Parameter setzen:

The following parameters can be set on the layerState object:

state (default value: “ON”)

The status changes that are to be made to the levels.

  • ON = The levels are to be displayed.
  • OFF = The levels are to be hidden.
  • TOGGLE = The visibility of the levels is to be switched.
layerState.setState(OCGStateType.TOGGLE);

The “referencedLayer” object

This object selects a level of the document by its name.

OCGSelectionType layerSelection = new OCGSelectionType();
layerState.getReferencedLayer().add(layerSelection);

The following parameters can be set on the layerSelection object:

name (default value: “”)

The name of the layer to be selected.

layerSelection.setName("LayerName");

transition-ActionType

When the element is selected, displays the display changes resulting from other actions, using the animation defined in this action.

TransitionActionType transitionAction = new TransitionActionType();
firstPage.getActions().add(transitionAction);

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

scaling (default value: “100”)

Defines the percentage value for the magnification to be applied during this animation.

transitionAction.setScaling(50);

effectDimensionHorizontal (default value: true)

Defines the axis along which the animation is to be executed for split and blind effects. If this value is set to true, the animation will play along the horizontal axis, otherwise it will play along the vertical axis.

transitionAction.setEffectDimensionHorizontal(false);

motionInward (default value: “true”)

Defines for split, box and fly animations whether the animation direction should run to the page midter (true) or to the page margins (false).

transitionAction.setMotionInward(false);

flyAreaOpaque (default value: “false”)

Defines for fly animations whether the “incoming” content layer should be initially transparent.

transitionAction.setFlyAreaOpaque(true);

flyScale (default value: “100”)

Defines the initial magnification factor of the “incoming” content layer as a percentage for fly animations.

transitionAction.setFlyScale(40);

direction (default value: “leftToRight”)

Defines the animation direction.

  • LEFT_TO_RIGHT = From left to right.
  • BOTTOM_TO_TOP = From bottom to top.
  • RIGHT_TO_LEFT = From right to left.
  • TOP_TO_BOTTOM = From top to bottom.
  • TOP_LEFT_TO_BOTTOM_RIGHT = From top left to bottom right.
  • NONE = Use the default value for the animation.
transitionAction.setDirection(OutlineTransitionDirectionType.LEFT_TO_RIGHT);

style (default value: “none”)

Sets the animation style.

  • BLINDS = Crossfade
  • BOX = Blend in rectangle
  • COVER = cover
  • DISSOLVE = Resolve
  • FADE = Fading
  • FLY = Fly in page
  • GLITTER = Resolve and replace page
  • PUSH = Move page out of image
  • SPLIT = Split page
  • UNCOVER = uncover page
  • WIPE = turn page
  • NONE = No special effect
transitionAction.setStyle(OutlineTransitionStyleType.WIPE);

duration (default value: “1.0”)

The duration of the animation in seconds. (Too high values can lead to problems in display programs.)

transitionAction.setDuration(0.3f);

goTo3DView-ActionType

Selecting the element jumps to a specific view of a 3D annotation. (The annotation is selected via an annotationSelection object.)

GoTo3DViewActionType goTo3DView = new GoTo3DViewActionType();
firstPage.getActions().add(goTo3DView);
AnnotationSelectionType annotationSelection = new AnnotationSelectionType();
goTo3DView.setAnnotation(annotationSelection);

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

index

Selects the 3D annotation view using the view index. (Alternative to name and relative)

goTo3DView.setIndex(5);

name

Selects the 3D annotation view using the view name. (Alternative to index and relative)

goTo3DView.setName("name");

relative

Selects the 3D annotation view relative to the currently displayed view. (Alternative to name and index).

  • FIRST = The first view of the 3D annotation.
  • LAST = the last view of the 3D annotation
  • NEXT = The next view of the 3D annotation
  • PREVIOUS = the previous view of the 3D annotation
  • DEFAULT = the STANDARD view of the 3D annotation
goTo3DView.setRelative(RelativeThreeDViewOperationType.LAST);

goToThread-ActionType

Jumps to a specific article defined in the document when the element is selected.

ThreadActionType thread = new ThreadActionType();
firstPage.getActions().add(thread);

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

threadIndex

Selects the article according to its index in the index of articles of the document. (Alternative to threadTitle.)

thread.setThreadIndex(4);

threadTitle

Selects the article based on its title. (Alternative to threadIndex.)

thread.setThreadTitle("threadTitle");

beadIndex

Selects the section of the article to jump to based on its index.

thread.setBeadIndex(6);

page (default value: “1”)

The page on which the article is located.

thread.setPage(3);

The object “removeā€

To remove elements from the table of contents of the document, add an OutlineType.Remove object to the Outline object.

OutlineType.Remove remove = new OutlineType.Remove();
outline.setRemove(remove);

The following elements can be added to the Remove object:

The object “itemReference”

To remove items, any number of ItemReference objects are added to the Remove object to select a node in the table of contents using paths. The paths are composed of the names of the items separated by slash(/), starting with an initial slash. If a node containing child elements is removed, these are also removed.

ItemReferenceType item = new ItemReferenceType();
remove.getItem().add(item);

The following parameters can be selected for an itemReference object:

path (default value: “”)

Selects an element in the table of contents by its path.

item.setPath("/Chapter 1/Page 250/3D View");

The “clear” object

To remove all elements from the table of contents of the document, add an OutlineType.Clear object to the Outline object.

ClearType clear = new ClearType();
outline.setClear(clear);

More detailed example

Finally a more detailed example for our entire webservice call (for addressing the SOAP interface):

try (
    // Setup of a session with the webPDF server (here SOAP):
    Session session = SessionFactory.createInstance(
        WebServiceProtocol.SOAP,
        new URL("https://localhost:8080/webPDF/")
    );
    // Provide the document to be processed
    // and the file in which the result is to be written:
    SoapDocument soapDocument = new SoapDocument(
        new File("Path of the source document").toURI(),
        new File("Path of the target document")
    )
) {
    // Selection of the webservice via a factory:
    ToolboxWebService toolboxWebService =
        WebServiceFactory.createInstance(
            session, WebServiceType.TOOLBOX
        );
    toolboxWebService.setDocument(soapDocument);
    toolboxWebService.getPassword().setOpen("password");
    toolboxWebService.getPassword().setPermission("password");

    // Object-oriented parameterization of the call:
    OutlineType outline = new OutlineType();
    toolboxWebService.getOperation().add(outline);
    
    //Creation of an outline element
    ItemType firstPage = new ItemType();
    outline.getAdd().getItem().add(firstPage);
    firstPage.setBold(true);
    firstPage.setColor("#FF0000");
    firstPage.setItalic(true);
    firstPage.setItemName("page1");
    firstPage.setPath("/root");
    firstPage.setPathPosition(AddPositionType.INPLACE);
    
    //Creation of the action that is to be executed as soon as 
    //the outline element is selected.
    ThreadActionType threadAction = new ThreadActionType();
    threadAction.setPage(1);
    threadAction.setThreadIndex(1);
    threadAction.setBeadIndex(1);
    firstPage.getActions().add(threadAction);

    // execution.
    toolboxWebService.process();
} catch (ResultException ex) {
    // To evaluate possible errors that have occurred, the
    // wsclient library appropriate methods are available:
}

Concluding remarks

  • More information about the outline parameter structure and error codes can be found in our user manual.
  • Please also note: All parameters are preset with certain default values. If a default value is specified and does not deviate from your desired value, it is not absolutely necessary to set this parameter.

More coding examples for webservices that you can use with the ws-client library can be found here.