Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

setting print attributes using script

  • 02-03-2005 07:24PM
    #1
    Closed Accounts Posts: 293 ✭✭


    is there anyway for me to define a printed page to have certain attributes such as lanscape with no margins using a script

    I have a very large page to be printed out with only specific cells to be shown? I know how to show the cells using css but is there anyway to change the attrib?


Comments

  • Closed Accounts Posts: 2,525 ✭✭✭JustHalf


    It's worth checking out the documentation here for CSS with paged media:
    http://www.w3.org/TR/REC-CSS2/page.html#page-size-prop

    One problem is margins. The browser usually adds some margins to the page that you have no control over. You have very little control over this - even if you set margins to 0, you will have browser added margins.

    Doing some work on this I found that even if you manually set the margins to zero in the browser print dialogue, and had margins set to 0 in the CSS, you STILL got margins on the page.

    It's a pain in the ass - at the moment, you need to accept a certain lack of control over the print style.


  • Closed Accounts Posts: 2,525 ✭✭✭JustHalf


    sinus wrote:
    I have a very large page to be printed out with only specific cells to be shown? I know how to show the cells using css but is there anyway to change the attrib?
    Can you clear this up for me?


  • Closed Accounts Posts: 7,488 ✭✭✭SantaHoe


    Not to hijack the thread, but does @page actually work at all?
    I've been trying to set a page to print in landscape by default using:
    @page rotated {size: landscape}
    table { page: rotated }

    And

    @page {size: landscape}

    But neither work, I still get portrait settings.
    One of these articles said browsers don't yet fully support @page ... so is there any point in using it?
    Or is there any alternative method?


  • Closed Accounts Posts: 9,314 ✭✭✭Talliesin


    sinus wrote:
    I have a very large page to be printed out with only specific cells to be shown? I know how to show the cells using css but is there anyway to change the attrib?
    I think you mean something like not printing a menu (since you can't navigate by clicking something on the page, so it makes no sense in that context) which can be done by putting the following in the CSS:
    @media print{
    	body{
    		margin: 0;
    	}
    	#menu, #someOtherBit{
    		display: none;
    	}
    }
    


  • Closed Accounts Posts: 9,314 ✭✭✭Talliesin


    JustHalf wrote:
    Doing some work on this I found that even if you manually set the margins to zero in the browser print dialogue, and had margins set to 0 in the CSS, you STILL got margins on the page.
    Most printers aren't capable of printing with absolutely no margin.


  • Advertisement
  • Closed Accounts Posts: 2,525 ✭✭✭JustHalf


    SantaHoe wrote:
    But neither work, I still get portrait settings.
    One of these articles said browsers don't yet fully support @page ... so is there any point in using it?
    Or is there any alternative method?
    If the print style sheets don't work, then I don't know of anything that will (all of my print work was in portrait).

    This will apparently work in IE5.5, but it doesn't work in Firefox:
    http://web.tampabay.rr.com/bmerkey/examples/landscape-test.html

    And this will work with an ActiveX plugin (which the user will presumably need to download and install):
    http://msdn.microsoft.com/library/default.asp?URL=/library/en-us/dnscrpt/html/dhtmlprint.asp

    Google is your friend:
    http://www.google.ie/search?hl=en&q=web+page+print+landscape&btnG=Google+Search&meta=

    Most print stuff isn't really handled very well by todays browsers. It's a pity, but a reality. You need to accept a certain loss of control. If you absolutely need something to print in landscape, why not distribute a PDF?

    Talliesin:
    This happened while printing to PDF too.


  • Closed Accounts Posts: 7,488 ✭✭✭SantaHoe


    Thanks for the links JH, I had been googling for references to @page which is where I found people talking about poor browser support :/
    Heh, does anyone else think "Google is your friend" has become the new RTFM? :D


  • Closed Accounts Posts: 2,525 ✭✭✭JustHalf


    No, it should be "Just f*cking google it!" :)


  • Closed Accounts Posts: 7,488 ✭✭✭SantaHoe


    :eek: :eek: :eek: :eek: :eek: :eek: :eek: :eek: :eek: :eek:
    Hey, I did use google, leamme alone.


  • Closed Accounts Posts: 2,525 ✭✭✭JustHalf


    No offense was intended.


  • Advertisement
  • Closed Accounts Posts: 7,488 ✭✭✭SantaHoe


    Are you calling me a liar?!

    :D


Advertisement