Prizm Content Connect
Class: ImageStamps

Class: ImageStamps

PCCViewer. ImageStamps

new ImageStamps(object)

The constructor for a ImageStamp Object. 'ImageStamp' object represents APIs for requesting the images and source from the server.

Parameters:
Name Type Description
object object

with link to imageHandler URL.

Example
var options = { imageHandlerUrl: "../pcc.ashx" }
var stamp = PCCViewer.ImageStamps(options);

Methods

getImageSourceURL(imageStampId)

Returns the image source URL for the imageStampId

Parameters:
Name Type Description
imageStampId string
Example
var options = { imageHandlerUrl: "../pcc.ashx" }
var stampApi = new PCCViewer.ImageStamps(options);

var imageUrl = stampApi.getImageSourceURL(imageStampId);

reqestImageSourceBase64(imageStampId) → {PCCViewer.Promise}

Retrieves the dataUrl (base64 image source), and dataHash (unique id) from the server for the provided imagesStampId

Parameters:
Name Type Description
imageStampId string
Returns:

a Promise object, on success returns a JSON object, on failure promise is rejected with reason. Returned JSON object will have dataUrl, and dataHash properties: dataUrl: base64 encoded image source dataHash: Encoded unique Id

Type
PCCViewer.Promise
Example
var options = { imageHandlerUrl: "../pcc.ashx" }
var stampApi = new PCCViewer.ImageStamps(options);
var imageStamps = {};
var base64Source = null;

var stampPromise = stampApi.requestImageStampList();

stampPromise.then(
    function onSuccess(data) {
        imageStamps = data.imageStamps;
        var base64Promise = stampApi.reqestImageSourceBase64(imageStamps[0].id);

        base64Promise.then(
            function onSuccess(imageSource) {
                base64Source = imageSource
                var pageNumber = 1;
                var rectangle = { x: 30, y: 30, width: 100, height: 100 };
                var mark = viewer.viewerControl.addMark(pageNumber, "ImageStampAnnotation");
                mark.setImage({ 
                    dataUrl: base64Source.dataUrl, id: base64Source.dataHash
                });
                mark.setRectangle(rectangle);
            }
        );

    },
    function onFailure(reason) {
        alert(reason)
    }
);

requestImageStampList(object) → {PCCViewer.Promise}

Retrieves the image stamp list from the server.

Parameters:
Name Type Description
object object

with web handler link assigned to the imageHandlerUrl property.

Returns:

a Promise object.

Type
PCCViewer.Promise
Example
var options = { imageHandlerUrl: "../pcc.ashx" }
var stampApi = new PCCViewer.ImageStamps(options);
var imageStamps = {};
var base64Source = null;

var stampPromise = stampApi.requestImageStampList();

stampPromise.then(
    function onSuccess(data) {
        imageStamps = data.imageStamps;
        var base64Promise = stampApi.reqestImageSourceBase64(imageStamps[0].id);

        base64Promise.then(
            function onSuccess(imageSource) {
                base64Source = imageSource
                var pageNumber = 1;
                var rectangle = { x: 30, y: 30, width: 100, height: 100 };
                var mark = viewer.viewerControl.addMark(pageNumber, "ImageStampAnnotation");
                mark.setImage({ 
                    dataUrl: base64Source.dataUrl, id: base64Source.dataHash
                });
                mark.setRectangle(rectangle);
            }
        );

    },
    function onFailure(reason) {
        alert(reason)
    }
);

 

 


©2014. Accusoft Corporation. All Rights Reserved.

Send Feedback