xCP 2.1 Custom JavaScript Function to Print iFrame Contents

Options
raghu2b
edited May 7, 2015 in Documentum #1

Hello everybody,

        In xCP 2.1 P05, we have created an application page which has iFrames [Using a value display, HTML type]. We need to provide an option to the user to print the contents of the iFrame only. For this we can use below core statement:

document.getElementById(frameID).contentWindow.print();

We have tried to create a custom javascript function, through a library, but this function is not getting listed in the widget's functions.

.js contents:

----------------------------------

Ext.namespace ('ntt.functions');

ntt.functions.mgcPrintIFrame = function (iFrameID) {

    document.getElementById(frameID).contentWindow.print()

};

---------------------------------

Attached is the custom library created for this.

Appreciate feedback/findings.

Thank you.

Raghu.

Tagged:

Comments

  • dnvhariprasad
    edited April 22, 2015 #2
    Options

    Try changing the bundle-name to mgc.PrintIFrame

  • shivac
    edited April 22, 2015 #3
    Options

    Hi Raghu,

    The component-bundle name in the Manifest file should match the namespace in the JS file. In the above Jar, component-bundle name is PrintIFrame and the namespace in JS file is ntt.functions.

    Replace ntt.functions with PrintIFrame in

    1) JS File

    2) xml file (namespace)

    3) upload the new jar.

  • samir.vaidya
    edited April 23, 2015 #4
    Options

    I don't see any problem with MANIFEST or XML. Can you just try adding return value to the function? e.g. have return type of STRING, and the just return some dummy string from the function.

  • SandipDabhade
    edited May 7, 2015 #5
    Options

    I am using xcp 2.2 , we are having one requirement where we want to print
    view page of a business object.

    is there any way we can achieve this? are you able to print iframe content?