I have several iframes in a page. I want to show in a print preview all the iframe contents as snapshots of iframes. I used window.print()
for individual iframes, and it's working fine, but how do I do it for multiple frames?
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
- Can php detect if javascript is on or not?
If
iframe
previews may be just static images, you can do the following:iframe
If you do it like this, you will have images with previews instead of iframes in print view.
May this code helpful for you..
HTML:
Script
Fiddle : http://jsfiddle.net/ackMC/5/
I think the biggest problem here is getting content from different frames into one view, which can be printed. Wether you want this in a .pdf or with
window.print()
. Is it possible for you to get the content of all frames which need to be printed into one document (frame)? For instance With AJAX, cURL, or PHP-methods? I think that's the only way to make one printable document of it.Good luck!
You need to focus all frames one-by-one and merge in print report.
You can achieve it, with this code:
HTML:
JavaScript:
CSS:
This CSS will hide print button on printed report.
Here is JsFiddle for you: http://jsfiddle.net/zur4ik/r7pvF/