-
Oct 3rd, 2013, 05:25 AM
#1
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??
-
Oct 3rd, 2013, 08:18 PM
#2
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.
-
Oct 3rd, 2013, 08:21 PM
#3
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?
-
Oct 3rd, 2013, 08:48 PM
#4
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!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|