"Work Notes"-Dynamic IFRAME content page printing

Source: Internet
Author: User

FTP Picture Attachment Batch Printing

Yesterday, a meeting with customers, the need is to batch select pictures to print. From the beginning, I was thinking about whether to do a word print on the server or a direct print on the browser side. Finally select front-end printing, because convenient. But the compatibility is not so good ~

Search information is also see a lot of netizens encounter this kind of problem, so posted out!

Front-end IFRAME printing

var printframe = $ ("<iframe style= ' width:100%;height:100%; ' id= ' printframe ' src= '). /print/printblankpage.html ' ></iframe> ') [0];

$ ("Body"). Append (Printframe);

var isfirstload = true;

Printframe.onload = Printframe.onreadystatechange = function () {

if (this.readystate! = ' complete ' | | (!isfirstload)) Return

else {

Isfirstload = false;

var body = PrintFrame.contentWindow.document.body;

$.each (Filepatharray, function (index, fileName) {

$ (body). Append ("

var FrameWindow = window.open (printFrame.contentWindow.location.href);

FrameWindow.document.open ();

FrameWindow.document.write ($ (body). HTML ());

FrameWindow.document.close ();

Framewindow.print ();

}

};

The document plug content of the window to open, printed after the plug is finished. Several methods have been tried, and this effect is most clear and effective.

"Work Notes"-Dynamic IFRAME content page printing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.