Results 1 to 4 of 4

Thread: Help with - Alternate document for printing

  1. #1
    Join Date
    Oct 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help with - Alternate document for printing

    1) Script Title: Alternate document for printing

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...printstyle.htm

    3) Describe problem: This doesn't seem to work in my browser. I'm running IE version 6.0 This script didn't work in my page and I did it exactly how it is in the script, so then I decided to see if it worked on your page and I got the same result. It prints a blank page with the URL at the bottom (which actually does say the other document - printversion.doc) but that's it. Any help would be appreciated!! Thanks!

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,070
    Thanks
    44
    Thanked 3,216 Times in 3,178 Posts
    Blog Entries
    12

    Default

    This is outdated and only works in IE. If you were to use a valid HTML page (with the .htm or .html extension) instead of a .doc, it might work in IE. The current cross browser method is to use a print stylesheet:

    HTML Code:
    <link rel="stylesheet" media="print" href="print.css">
    The file print.css would contain alternate styles for printing the page, not an alternate document. In print.css you could set the display property of those sections of the document that you don't want to be printed to none:

    Code:
    .noprint {
    display:none;
    }
    Then anything you don't want printed on the page could be like:

    HTML Code:
    <p class="noprint">This won't get printed</p>
    You are not limited to just the display property. You can alter the style of elements and still have them print (let's say the body of your page is usually white text on a blue background, not so hot for printing):


    Code:
    body {
    color:black;
    background-color:white;
    margin:0;
    padding:0;
    }
    You can also include printer only styles in an ordinary stylesheet like so:

    Code:
    @media print {
    body {
    color:black;
    background-color:white;
    margin:0;
    padding:0;
    }
    }
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Oct 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I need to print a pdf version to be compliant - is there no way at all to do that? In my other html files I do have the css for printing, but for the products they ONLY want the pdf version to be printed....any other thoughts?

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,070
    Thanks
    44
    Thanked 3,216 Times in 3,178 Posts
    Blog Entries
    12

    Default

    Well, .pdf depends upon the user having a program configured for displaying/printing such files. Most folks have one but, it may be out of date, some folks may not have any. So, this is just a bad idea to begin with. It has nothing to do with compliance except to the misguided wishes of whoever is requiring it of you. You can have a link on the page to the .pdf version. You can have it be:

    HTML Code:
    <a href="some.pdf">.pdf version for printing</a><br>
    Need a .pdf reader/printer?<br>
    <a href="http://www.adobe.com/products/acrobat/readstep2.html">Free Adobe Acrobat .pdf reader/printer</a>
    You could also set the print style display property for the page to none.

    This is about as close as you can come.

    I'd experiment with making everything on the page display:none; for printing except an iframe that contains the .pdf version:

    HTML Code:
    <iframe style="width:100%;height:100%;display:none;" src="some.pdf"></iframe>
    Set its style to display:inline; for printing but, I'm not sure that this would work out too well in actual practice.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •