Configuring the document builder module

You can configure the document builder module, which you can use to edit a PDF or TIFF document.

Before you begin

IBM® Daeja® ViewONE provides an edit mode that is called document builder, in addition to the annotation and redaction modes. With the document builder module, you can add, copy, move, rotate, and reorder pages in a PDF or TIFF document that is displayed in the viewer. You can also add annotations to this document.

For more information, see ViewONE Document builder module.

About this task

Configuring the document builder module with HTML parameters
You can specify which edit mode you want with the editModeToggle parameter:
<param name =”editModeToggle” value=”<EDIT MODE(S)>” />
By default, the edit mode is Annotate. To set another mode by default, use the initialEditMode parameter:
<param name=”initialeditmode” value=”<EDIT MODE>” />
When you are in the document builder edit mode, the Cut, Copy, and Paste buttons are displayed on the top toolbar by default. To add the Build document button to the toolbar, use the documentBuilderShowButtons parameter:
<param name= “documentBuilderShowButtons” value=”builddocument” />
Switching to document builder edit mode
After you configured the document builder with HTML parameters, you can easily switch to this mode by using the user interface or a JavaScript API:
  • User interface: You can find the available edit modes to the lower right of the lower toolbar. If you select a different edit mode, it initializes the start mode change sequence.
  • JavaScript API: To switch to the document builder mode, use the setEditMode(String) method:
    ViewONE.setEditMode(‘<EDIT MODE(S)>’)
Events fired when changing the edit modes

When you switch to the document builder mode, a new event, Mode Change Start (event ID: 85) is fired. This allows you to cancel switching between modes.

This new event has a callback to allow the cancellation or confirmation of the mode change. If you cancel the mode change by using the following callback, the event Mode Change Cancelled (event ID: 86) is fired. If you allow the mode to be changed, the original Mode Changed event (event ID: 77) is fired.

JavaScript event handlers that have a registered interest in event 85 must include a parameter callbackid:
function modeChangeStartEventHandler(id, mode, callbackId)
Where the attributes are:
  • id: The event ID.
  • mode: The edit mode being switched to annotate, redact, or docbuilder.
  • callbackId: The ID of the callback for this event.
Event handlers that handle event 85 need to call the following JavaScript API call:
setEventHandlerCallbackResponse(callbackId, response)
Where the attributes are:
  • callbackId: the callback ID obtained from the event handler.
  • response: ok to allow the mode change to continue, all other values cancel the action.
Note: When you change the edit mode to document builder, it is possible that the document might not be compatible with the mode. In this case, the mode change is cancelled and event 86 is dispatched. When event 86 is not being listened for by the viewer client, a dialog is displayed that indicates that the document builder mode could not be entered.
There are two known reasons for failure to enter document builder mode:
  • The document is not a supported mime-type.
  • The document is a PDF with access permissions that block the editing of the document. PDF documents can be blocked because the author has set a password that is required for viewing the document, or specified that the content of the PDF cannot be copied.