locked
Printing an aspx page into IFRAME from a CRM Button RRS feed

  • Question

  • Hi every body,
    I want to know haw can I print an aspx page into IFRAME by custom CRM Button
    thx
    Thursday, June 25, 2009 10:31 AM

Answers

  • Hi Balhato,

    You should give this code a try :

    window.frames[x].window.focus();
    window.frames[x].window.print();

    x is the number of the frame you are trying to print, if you are familiar with IE Dev toolbar you will be able to figure out easily otherwise you will have to run this command few times.

    Also, if that doesn't work for you then, try

    document.getElementById(IFRAMEID).window.focus();
    document.getElementById(IFRAMEID).window.print();
    Regards,
    Chinmay
    http://metrix.blogspot.com
    Thursday, June 25, 2009 5:08 PM

All replies

  • Hi ,

    You can do this by adding a button throug the isv ...

    You add the below code under the entity tag in which you want to have the button

    <Button Icon="/_imgs/ico_18_debug.gif" Url="http://myserver/mypage.aspx" PassParams="1" WinParams="toolbar=no,scrollbars=yes,resizable=1,height=800,width=700,location=no" WinMode="0" AvailableOffline="false">
    Thanks, Aarch
    Thursday, June 25, 2009 10:57 AM
  • yes the button is ok, but haw can I print it ,I mean the javascript code allow to print the aspx page
    Thursday, June 25, 2009 11:08 AM
  • Hi Balhato,

    To print from Javascript use : window.print();
    Regards,
    Chinmay
    http://metrix.blogspot.com
    Thursday, June 25, 2009 11:41 AM
  • To print the aspx page is the following the correct code:
    crmForm.all.IFrame.window.print();

    Thursday, June 25, 2009 1:39 PM
  • The question is: Can i get the Window object of aspx page into an IFrame?
    Thursday, June 25, 2009 2:30 PM
  • Hi, Balhato.

    Try to use following construction:

    crmForm.all.IFrame.contentWindow.print();

    Truth is opened the prepared mind My blog - http://a33ik.blogspot.com
    Thursday, June 25, 2009 2:32 PM
    Moderator
  • I try it but the construction open a blank window!!
    Thursday, June 25, 2009 2:56 PM
  • Hi Balhato,

    I am still saying the same, try window.print(); it worked fine for me. Is there any specific requirement you are trying to address? Can you please upload a screenshot or something to skydrive.live.com, showing what area of CRM you want to take print of?
    Regards,
    Chinmay
    http://metrix.blogspot.com
    Thursday, June 25, 2009 3:49 PM
  • Thank you Chinmay, I know that the window.print print the page, but the problem is the aspx page still into an IFrame and the print button its not into the aspx page its on the entity form, so the idea its to clik on the this button to print the aspx page, In trying to get the window Object to call the print function
    Thursday, June 25, 2009 3:57 PM
  • Hi Balhato,

    You should give this code a try :

    window.frames[x].window.focus();
    window.frames[x].window.print();

    x is the number of the frame you are trying to print, if you are familiar with IE Dev toolbar you will be able to figure out easily otherwise you will have to run this command few times.

    Also, if that doesn't work for you then, try

    document.getElementById(IFRAMEID).window.focus();
    document.getElementById(IFRAMEID).window.print();
    Regards,
    Chinmay
    http://metrix.blogspot.com
    Thursday, June 25, 2009 5:08 PM