Exporting html report for printing

I have an HTML report that users want to be able to print out. I want to make sure it is properly formatted for printing so i'm exporting it out to MS Word first. The issue i have is that any images that exist in the HTML version are lost on the export and my page breaks are also lost.
I would do it without the export to MS Word routine but then the reports have the url on the header and footer and it looks really messy. Any ideas anyone?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

What you can do is create a CSS style for your page that uses ' media="print" ', this will allow you to create a style layout for your page that will only be applied when the page is printed (thusly you can set new font size, spacing, image placement).  See the following links for some easy how-to steps:



johnnymc1Author Commented:
will this allow me to remove the URL that appears at the top and bottom of the page though?
you can remove the url in your browsers print settings/page setup in both internet explorer and firefox
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

You can also look at MeadCo's ScriptX.


They have both a full version and free version that allows you to remove the hdr and footer that the browser supplies. That way you wont have to change everyone's browser settings.

I use the free version and it serves my purposes.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ScriptX, as suggested by beermequick is good.

Also, you can try exporting as a PDF with http://itextsharp.sourceforge.net/ 

PDF, I guess, would have more granular control on printing right?
iText is very nice too.  

You can get some very nice looking reports via the API, but it can be quite cumbersome to use if your report is extensive.

If these reports are for upper management, I would make the extra effort using iText as the result is far more eye applealing,  But if its form some bean counter that is going to put it on a pile of 10 million other papers, then the ScriptX will be much easier on you.

Here is a code snippet I use for scriptx

// This goes in a javascript file

var PORTRAIT = true;
var LANDSCAPE = false;

function printDocument(buttonDivId, orientation){
    var elem = document.getElementById(buttonDivId);
    elem.style.display = "none";  

    var h = factory.printing.header;
    var f = factory.printing.footer;  
    var tm = factory.printing.topMargin;
    var bm = factory.printing.bottomMargin;
    factory.printing.header = "";
    factory.printing.footer = "&b&bPage &p of &P";
    factory.printing.portrait = orientation;      
    factory.printing.topMargin = 0.5;
    factory.printing.bottomMargin = 0;
    factory.printing.header = h;
    factory.printing.footer = f;  
    factory.printing.topMargin = tm;
    factory.printing.bottomMargin = bm;
    elem.style.display = "block";

in my webpage....I put a button
<div ID="printButton">
  <table WIDTH="660" BORDER="0" ALIGN="CENTER">
      <td align="LEFT">
        <input TYPE="Button"

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.