Deprecated Prizm Content Connect
Events

JavaScript events to and from the Viewer

Prizm Content Connect is built in such a way that it can be truly integrated and embedded into your application. Events are JavaScript AJAX calls that the Viewer can generate when certain actions occur. Developers can also send JavaScript AJAX events to the Viewer from their code and have the Viewer perform certain actions without reloading the whole page.

Sending Events to the Viewer

To send events to the viewer, follow these steps:

  1. Pass a FlashVar to ViewerEnterprise.swf to indicate you will be sending events to Viewer:

sendViewerEvents=Yes

  1. Add the following code to the page where you call ViewerEnterprise.swf:
Example
Copy Code
<script>
documentviewer = $.flash.create (
 {
  swf: 'ViewerEnterprise.swf',
  id:'ViewerEnterprise',
  height: 600,
  width: 750,
  wmode: 'window',
  scale: 'noscale',
  allowFullScreen: true,
  allowScriptAccess: 'always',
  hasVersion: 10,
  encodeParams: false,
  bgcolor: '#ffffff',  
  flashvars: {
   documentname: '<%=document %>',
   sendViewerEvents:'Yes',
   }
 }
);
$(document).ready(
 function () {
  $('#documentviewer').html(documentviewer);
 }
);
</script>
  1. The sendTextToFlash function is used to interact with the viewer. (2 arguments are required: Command:String and Argument:String or Number)

Argument is 0 in all cases.

The following events can be sent:

Event

Details

Next

Move to next page

Previous

Move to previous page

ZoomIn

Zoom In on the document

ZoomOut

Zoom Out on document

FitWidth

Set Zoom=100%

MoveDown

Move the page down

MoveUp

Move the page up

MoveLeft

Move the page left

MoveRight

Move the page right

Print

Print the document. Opens print dialog.

 

Example
Copy Code
<a href=javascript:ViewerEnterprise.sendTextToFlash("Previous")>Previous</a>
<a href=javascript:ViewerEnterprise.sendTextToFlash("Next")>Next</a>
<a href=javascript:ViewerEnterprise.sendTextToFlash("ZoomIn")>Next</a>

Receiving Events from the Viewer

The Viewer can send events when certain actions are performed.

To receive the events follow these steps:

  1. Pass a FlashVar to ViewerEnterprise.swf to indicate you will be sending events to Viewer:

getViewerEvents=Yes

  1. Add the JavaScript code in your page as shown below:
Example
Copy Code
<script>
documentviewer = $.flash.create (
 {
  swf: 'ViewerEnterprise.swf',
  id:'ViewerEnterprise',
  height: 600,
  width: 750,
  wmode: 'window',
  scale: 'noscale',
  allowFullScreen: true,
  allowScriptAccess: 'always',
  hasVersion: 10,
  hasVersionFail: function (options) {
  alert("You do not have required flash version");
  },
  encodeParams: false,
  bgcolor: '#ffffff',  
  flashvars: {
   documentname: '<%=document %>',
   getViewerEvents:'Yes',
   }
 }
);
$(document).ready(
 function () {
  $('#documentviewer').html(documentviewer);
 }
);
</script>

The following events are sent by ViewerEnterprise.swf:

Event

Details

onDocumentError(documentname, pagenumber)

A custom HTTP Status Error Code 500 is returned from conversion url instead of converted swf

viewerOnDocumentZoom(documentname,zoom)

Zoom is pressed.

Returns documentname & zoom size

viewerOnDocumentScroll(documentname)

Document is scrolled

viewerOnDocumentLoad(documentname)

Document is loaded in the viewer

viewerOnDocumentDownload(documentname)

Document is downloaded/Save button was pressed

viewerOnDocumentRotate(documentname)

Document is rotated by 90 degree

viewerOnDocumentPrint(documentname)

Print button was clicked

viewerOnDocumentFullScreen(documentname)

Document is viewed in Full Screen Mode

viewerOnSelectText(documentname,pagenumber,startpos,endpos,selecetdtext)

Text is selected on document.

Returns Document Name, Page Number, Start Character Position of Text Highlighted, End Character Position of Text Highlighted, Selected Text Contents

viewerOnDocumentTextSelected(documentname)

After text selection is complete

viewerOnInternalLinkClick(pageClicked)

An internal link in document is clicked. Like bookmark or link to another page in the document

viewerOnExternalLinkClick(linkUrl)

An external link in document is clicked. Like www.google.com is a link in document and is clicked

onHighlightEvent(eventName , highlightXML)

This is the event passed by viewer when a certain text is selected by used and added as Highlight, Link, Tag or Redaction.

onPagesAllLoaded()

 

Fired when all pages in the document have been loaded

onThumbView()

Fired when user clicks on thumbnail view button

onFullView()

Fired when user comes out of the thumbnail view

tabChanged ( nameOfActivatedTab:String )

 

Event fired when tab is changed in the viewer

Highlight Events Sent by Viewer 

JavaScript method that is called : onHighlightEvent ( eventName , highlightXML )

eventNames
highlightSaveMenuOpened
highlightAdd
highlightExistingMenuOpened
highlightMenuCancelled
highlightRemove
highlightOpenLink

Example
Copy Code
<script language="javascript">
function viewerOnDocumentPrint(documentname)
{
   alert(“document: ” + documentname);
}
function viewerOnSelectText(documentname,pagenumber,startpos,endpos,selecetdtext)
{
alert(startpos+" "+endpos);
}
function onHighlightEvent(eventName, highlightXML)
{
   alert(eventName + "  " + highlightXML);
}
</script>

Annotation Events to/from Viewer

Sending Events

To send Annotation Events to the Viewer, follow these steps:

  1. Pass a FlashVar to ViewerEnterprise.swf to indicate you will be sending events to Viewer:

sendViewerEvents=Yes

  1. In your page where you call ViewerEnterprise.swf, add the following code
Example
Copy Code
<script>
documentviewer = $.flash.create(
 {
  swf: 'ViewerEnterprise.swf',
  id:'ViewerEnterprise',
  height: 600,
  width: 750,
  wmode: 'window',
  scale: 'noscale',
  allowFullScreen: true,
  allowScriptAccess: 'always',
  hasVersion: 10,
  encodeParams: false,
  bgcolor: '#ffffff',  
  flashvars: {
   documentname: '<%=document %>',
   sendViewerEvents:'Yes',
   }
 }
);
$(document).ready(
 function () {
  $('#documentviewer').html(documentviewer);
 }
);
</script>

Receiving Events

The Viewer can send events when certain actions are performed by the user.

To receive events, follow these steps:

  1. Pass a FlashVar to ViewerEnterprise.swf to indicate you will be sending events to Viewer:

getViewerEvents=Yes

  1. Add the javascript code in your page as shown below:
Example
Copy Code
<script>
documentviewer = $.flash.create(
 {
  swf: 'ViewerEnterprise.swf',
  id:'ViewerEnterprise',
  height: 600,
  width: 750,
  wmode: 'window',
  scale: 'noscale',
  allowFullScreen: true,
  allowScriptAccess: 'always',
  hasVersion: 10,
  hasVersionFail: function (options) {
  alert("You do not have required flash version");
  },
  encodeParams: false,
  bgcolor: '#ffffff',  
  flashvars: {
   documentname: '<%=document %>',
   getViewerEvents:'Yes',
   }
 }
);
$(document).ready(
 function () {
  $('#documentviewer').html(documentviewer);
 }
);
</script>

The following events are sent by the Viewer:

Event

Details

willSaveAnnotations(xml)

Fired when Save Annotations Button is clicked.

Request for saving annotations is being sent to server.

Argument xml is the annotation xml

hasSavedAnnotations(xml)

 

 

Fired when Save Annotations Button is clicked.

After the annotations have been saved on the server.

Argument xml is the annotation xml

onAnnotationDrawn(annotationType)

 

 

 

Called when shape is drawn

 

Valid annotationType arguments returned:

circle, circle_filled, rectangle

rectangle_filled, rectangle_trans, line, arrow, text, stamp

pccMarkAdded(annotationID)

This is called upon creation of an annotation. 

annotationID is the unique identifier of the annotation and allows customers to further process this action.

pccMarkChanged(annotationID) This is called when an annotation is changed in any way (translated, rotated or edited). 
 
annotationID is the unique identifier of the annotation and allows customers to further process this action.
pccMarkRemoved(annotationID)

This is called upon deletion of an annotation. 

annotationID is the unique identifier of the annotation. Just prior to the issuance of this call, the annotation is removed from the stage and, thus, no longer accessible.

 

 

 


©2014. Accusoft Corporation. All Rights Reserved.

Send Feedback