Content Management and Capture

 View Only
Expand all | Collapse all

Adding annotations programmatically using the JavaScript api

  • 1.  Adding annotations programmatically using the JavaScript api

    Posted Tue August 29, 2023 11:26 AM

    Hi,

    I have a requirement to add annotations programmatically using the JavaScript api. I have tried below using the custom plug-in.

    require(["dojo/_base/declare",
             "dojo/_base/lang"], 
    function(declare, lang) {
    	alert('here');		
    	ViewONE.addAnnotation("[TEXT]<P>X=300<P>Y=350<P>TEXT = This is line 1<N>This is line 2<P>FONTHEIGHT = 34<P>PAGE=1<P>EDIT = 1<P>FILLCOLOR = 255, 255, 0<P>ROTATION = 0<P>TEXTROTATION = 90<P>TRANSPARENT = 0<P>SEMITRANSPARENT = 0<P>");
    });
    

    Getting the following error "ViewONE is not defined". I have searched in navigator web application for the ViewONE js file. But could not find. Please help me how to resolve the issue.



    ------------------------------
    RAVI KUMAR
    ------------------------------


  • 2.  RE: Adding annotations programmatically using the JavaScript api

    Posted Wed August 30, 2023 06:37 AM

    Hello Guys,

    Can any one help here.



    ------------------------------
    RAVI KUMAR
    ------------------------------



  • 3.  RE: Adding annotations programmatically using the JavaScript api

    Posted Wed August 30, 2023 12:09 PM

    You might have to define the exact path for your viewer.

    Please review the steps in this link to start the viewer using js api:

     https://www.ibm.com/docs/en/daeja-viewone/5.0.x?topic=viewer-configuring-virtual-client-by-using-javascript
    https://www.ibm.com/docs/en/daeja-viewone/5.0.x?topic=reference-javascript-api

    If you have any further issues, please do create case with IBM Daeja Support.



    ------------------------------
    RAMA LINGAM
    ------------------------------



  • 4.  RE: Adding annotations programmatically using the JavaScript api

    Posted Thu August 31, 2023 09:42 AM

    Hi Rama,

    Thank you. My requirement is not to start the viewer using js api. If I open a document in Daeja viewer, it should have dynamic annotations(Like: Case Information). Hence need to add annotations programmatically to the the viewer. Please let me know whether it should be done by Plug-in or any other way?



    ------------------------------
    RAVI KUMAR
    ------------------------------



  • 5.  RE: Adding annotations programmatically using the JavaScript api

    Posted Thu August 31, 2023 12:50 PM

    Hello Ravi, You will ned to add annotations programmatically using custom plugin.



    ------------------------------
    RAMA LINGAM
    ------------------------------



  • 6.  RE: Adding annotations programmatically using the JavaScript api

    Posted Fri September 01, 2023 07:24 AM

    Hi Rama,

    ok thank you. I have tried below code.

    require(["dojo/_base/declare",
             "dojo/_base/lang"], 
    function(declare, lang) {
    	alert('here');		
    	ViewONE.addAnnotation("[TEXT]<P>X=300<P>Y=350<P>TEXT = This is line 1<N>This is line 2<P>FONTHEIGHT = 34<P>PAGE=1<P>EDIT = 1<P>FILLCOLOR = 255, 255, 0<P>ROTATION = 0<P>TEXTROTATION = 90<P>TRANSPARENT = 0<P>SEMITRANSPARENT = 0<P>");
    });

    Getting the following error "ViewONE is not defined". I have searched in navigator web application for the ViewONE js file. But could not find.

    Can you share the working code if you have.



    ------------------------------
    RAVI KUMAR
    ------------------------------



  • 7.  RE: Adding annotations programmatically using the JavaScript api

    Posted Fri September 01, 2023 08:26 AM

    I don't see you are invoke viewone.js at all in your code that you have posted here.

    Here is how you initiate viewone.js.

    <!DOCTYPE html>
    <HTML>

    <script type="text/javascript"src="../viewoneHTML/v1files/viewone.js">

    </script>
    <OBJECT CLASS = "com.ibm.dv.client.Viewer"
    ID = "viewone"
    WIDTH = "100%"
    HEIGHT = "800">

    <param name="filename" value="http://localhost:8080/test.pdf">
    <param name="annotate" value= "true">
    <param name="annotateEdit" value= "true">
    </OBJECT>
    </HTML>
     



    ------------------------------
    RAMA LINGAM
    ------------------------------



  • 8.  RE: Adding annotations programmatically using the JavaScript api

    Posted Mon September 04, 2023 06:27 AM

    Hi Rama,

    Thank you. I am not sure why I need to invoke viewone.js. I want to use OOTB viewer. Additionally I want to show annotations on the viewer if the user opens a document.

    Usually navigator plugin has independent files for html and java script. May I know is the code provided by you should be put in which file?



    ------------------------------
    RAVI KUMAR
    ------------------------------



  • 9.  RE: Adding annotations programmatically using the JavaScript api

    Posted Mon September 04, 2023 09:55 AM

    Here is the sample code for ICN plugin:

    https://www.ibm.com/support/pages/using-icn-plugin-customize-daeja-viewone-launch



    ------------------------------
    RAMA LINGAM
    ------------------------------



  • 10.  RE: Adding annotations programmatically using the JavaScript api

    Posted Mon September 04, 2023 01:45 PM

    Thank you very much Rama. I will check.



    ------------------------------
    RAVI KUMAR
    ------------------------------