1

I'm using the jqprint plugin and really like how it operates with only one problem. I need to add color to the object that I'm trying to print. I tried to colorize the object before it gets sent to Jqprint but that didn't change anything. I know you can write CSS inside a @media tag but when my html gets rendered into the print preview in chrome it seems to be changed into a pdf and I can't access the elements like regular html.

Does anyone use any other printing plug ins or have any ideas on how to get color into my printing with jqprint.

Basically I have a table that I send to jqprint like this:

var $printStuff = $("#divTable");
$printStuff.jqprint();
Collin Estes
  • 5,577
  • 7
  • 51
  • 71

2 Answers2

1

I was looking for a better solution and, in case you want to change more than one CSS style for the printed version, I recommend you to add an specific CSS file for that funcionality:

<link rel="stylesheet" type="text/css" media="print" href="print.css" />

Inside the CSS file you can also hide content using this line:

.classToHide { display: none; }

Regards.

IsaacSF
  • 126
  • 5
0

It is not the most clean solution, but you can try to add the style directly to the printed object, just before the jqprint() call.

I also preffer to create a copy of the printed object, because it does not affect the object inside the loaded page. After the printing, destroy it.

var $printStuff = $("#divTable").clone();

$printStuff.css("color", "blue");

$printStuff.jqprint();
$printStuff.empty().remove();

Remember that you can manipulate the cloned object too, removing the tags you won't print.

Try it and good luck!

IsaacSF
  • 126
  • 5