Jump to content

kalilxd11

Members
  • Posts

    5
  • Joined

  • Last visited

Posts posted by kalilxd11

  1. On 8/16/2017 at 4:27 PM, delagoutte said:

    For print html, i'm using uniHtmlMemo but i think it must work with unihtmlframe.

     

    i have a dedicated unimemo for print working .

     

    in memoExport.Clientsevent.extevents

    
    function dirtychange(sender, isDirty, eOpts)
    {
        ajaxRequest(sender, "changeforprint", []);
    }

    memoexport.onAjaxevent :

    
     if EventName = 'changeforprint' then
      begin
        if MemoExport.Text<>'' then
        begin
          UniSession.AddJs(
          'var browserName = navigator.userAgent.toLowerCase(); '+
          'if ( browserName.indexOf("msie") != -1)  '+
          '{'+
            MemoExport.jsname+'.iframeEl.dom.contentWindow.focus();'+
            MemoExport.jsname+'.iframeEl.dom.contentWindow.print();'+
          '} '+
         'else '+
         '{'+
           'if(browserName.indexOf("trident") != -1) '+
           '{'+
             MemoExport.jsname+'.iframeEl.dom.contentWindow.focus();'+
             MemoExport.jsname+'.iframeEl.dom.contentWindow.document.execCommand(''print'', false, null);'+
           '}'+
           'else '+
           '{'+
            MemoExport.jsname+'.iframeEl.dom.contentWindow.focus();'+
            MemoExport.jsname+'.iframeEl.dom.contentWindow.print();'+
           '};'+
          '};');
          MemoExport.Text:='';
        end;

    if you want print a html, i load it in memoexport

    
    MemoExport.Text:= GetHtmlPrint;

    Important : the uniMemoHtml must be visible = true if you don't want see it set top = -1000;

    Thank you, your example worked for me!

×
×
  • Create New...