admin管理员组

文章数量:1026989

I'm trying to print a section of a web page and there are multiple css files, and several of those files contribute to the "print" media type. Some of the plugins I've seen assume that you only have one media="print" css file and that's all it needs. I have looked at PrintArea and jsprint and am not very impressed by either of them, I believe I can tweak them to get what I need, but I'm hoping there is a better library out there that I have yet to discover.

I'm trying to print a section of a web page and there are multiple css files, and several of those files contribute to the "print" media type. Some of the plugins I've seen assume that you only have one media="print" css file and that's all it needs. I have looked at PrintArea and jsprint and am not very impressed by either of them, I believe I can tweak them to get what I need, but I'm hoping there is a better library out there that I have yet to discover.

Share Improve this question asked Nov 24, 2010 at 15:29 vaskinvaskin 5133 silver badges11 bronze badges 1
  • in my case printjs.crabbly. – Phd. Burak Öztürk Commented Apr 24, 2018 at 20:37
Add a ment  | 

2 Answers 2

Reset to default 5

Have a look at printThis. It es loaded with several options, such as load css.

$("#mySelector").printThis({ debug: false, // show the iframe for debugging importCSS: true, // import page CSS importStyle: false, // import style tags printContainer: true, // grab outer container as well as the contents of the selector loadCSS: "path/to/my.css", // path to additional css file - use an array [] for multiple pageTitle: "", // add title to print page removeInline: false, // remove all inline styles from print elements printDelay: 333, // variable print delay header: null, // prefix to html footer: null, // postfix to html base: false , // preserve the BASE tag, or accept a string for the URL formValues: true, // preserve input/form values canvas: false, // copy canvas elements (experimental) doctypeString: "...", // enter a different doctype for older markup removeScripts: false, // remove script tags from print content copyTagClasses: false // copy classes from the html & body tag });

I was just looking at PrintArea's source, and it seems that it does take into account multiple stylesheets. It would help if you told us what exactly you don't like about the libraries.

Also, I'm not sure how much more you'll be able to acplish with a JS-only solution than the a plugin such as PrintArea already does.

I'm trying to print a section of a web page and there are multiple css files, and several of those files contribute to the "print" media type. Some of the plugins I've seen assume that you only have one media="print" css file and that's all it needs. I have looked at PrintArea and jsprint and am not very impressed by either of them, I believe I can tweak them to get what I need, but I'm hoping there is a better library out there that I have yet to discover.

I'm trying to print a section of a web page and there are multiple css files, and several of those files contribute to the "print" media type. Some of the plugins I've seen assume that you only have one media="print" css file and that's all it needs. I have looked at PrintArea and jsprint and am not very impressed by either of them, I believe I can tweak them to get what I need, but I'm hoping there is a better library out there that I have yet to discover.

Share Improve this question asked Nov 24, 2010 at 15:29 vaskinvaskin 5133 silver badges11 bronze badges 1
  • in my case printjs.crabbly. – Phd. Burak Öztürk Commented Apr 24, 2018 at 20:37
Add a ment  | 

2 Answers 2

Reset to default 5

Have a look at printThis. It es loaded with several options, such as load css.

$("#mySelector").printThis({ debug: false, // show the iframe for debugging importCSS: true, // import page CSS importStyle: false, // import style tags printContainer: true, // grab outer container as well as the contents of the selector loadCSS: "path/to/my.css", // path to additional css file - use an array [] for multiple pageTitle: "", // add title to print page removeInline: false, // remove all inline styles from print elements printDelay: 333, // variable print delay header: null, // prefix to html footer: null, // postfix to html base: false , // preserve the BASE tag, or accept a string for the URL formValues: true, // preserve input/form values canvas: false, // copy canvas elements (experimental) doctypeString: "...", // enter a different doctype for older markup removeScripts: false, // remove script tags from print content copyTagClasses: false // copy classes from the html & body tag });

I was just looking at PrintArea's source, and it seems that it does take into account multiple stylesheets. It would help if you told us what exactly you don't like about the libraries.

Also, I'm not sure how much more you'll be able to acplish with a JS-only solution than the a plugin such as PrintArea already does.

本文标签: