Results 1 to 4 of 4

Thread: Printing an IFRAME - user would like to be able to EMAIL it instead

  1. #1

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Printing an IFRAME - user would like to be able to EMAIL it instead

    Currently I'm using this function to build a hidden iframe and then print it (I am using the jQuery library if that matters)...

    Code:
            function printPanel(wesPP) {
                var strTitle = "";
                var strHTML = wesPP.html();
                // Create a random name for the print frame.
                var strFrameName = ("printer-" + (new Date()).getTime());
    
                // Create an iFrame with the new name.
                var jFrame = $("<iframe name='" + strFrameName + "'>");
    
                // Hide the frame (sort of) and attach to the body.
                jFrame
    		            .css("width", "1px")
    		            .css("height", "1px")
    		            .css("position", "absolute")
    		            .css("left", "-9999px")
    		            .appendTo($("body:first"))
    	            ;
                // Get a FRAMES reference to the new frame.
                var objFrame = window.frames[strFrameName];
    
                // Get a reference to the DOM in the new frame.
                var objDoc = objFrame.document;
    
                // Write the HTML for the document. In this, we will
                // write out the HTML of the current element.
                objDoc.open();
                objDoc.write('<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">');
                objDoc.write("<" + "html>");
                objDoc.write("<" + "body>");
                objDoc.write("<" + "head>");
                objDoc.write("<" + "title>");
                objDoc.write(strTitle);
                objDoc.write("<" + "/title>");
                objDoc.write("<" + "link href='css/AWCOffice.css' rel='stylesheet' type='text/css' />");
                objDoc.write("<" + "/head>");
                objDoc.write("<div class='acs-edit-print'>" + strHTML + "</div>");
                objDoc.write("<" + "/body>");
                objDoc.write("<" + "/html>");
                objDoc.close();
    
                // Print the document.
                objFrame.focus();
                objFrame.print();
    
                // Have the frame remove itself in about a minute so that
                // we don't build up too many of these frames.
                setTimeout(
    		            function() {
    		                jFrame.remove();
    		            },
    		            (60 * 1000)
    		            );
    
            }
    The user has asked me if it is possible for this to go right into an email instead.

    Any ideas??

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  2. #2
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,605

    Re: Printing an IFRAME - user would like to be able to EMAIL it instead

    Do they want to be able to e-mail the page to someone else? The only way to do that would be to do it all server-side. I doubt it's possible to create an HTML e-mail from a mailto: link, or if it was it would be horribly messy.
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

  3. #3
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,605

    Re: Printing an IFRAME - user would like to be able to EMAIL it instead

    All the "E-mail page" links that I've seen appear to just send a request to the server which then generates the content for the e-mail and sends it off. Can they not just print to PDF and then e-mail the PDF?
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

  4. #4

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Printing an IFRAME - user would like to be able to EMAIL it instead

    Yes - I've seen that to be true - not possible from the client side....

    Worse problem - on a MAC using FF the printable page doesn't even .PRINT properly. And I don't have a mac to test this with - arghh!!!

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width