Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jan 2012
    Location
    Hastings, East Sussex, UK
    Posts
    34
    Thanks
    21
    Thanked 0 Times in 0 Posts

    Post Printing page Ignores Font size & Orientation

    I am trying to sort out a problem I have with my CSS script for controling the printout.

    Some text which is generated from a MySQL database, neesd to be printed in a particular place on the paper, this I have controled using CSS. I have two problems:
    1) It does not always printout in the right size font. (The font face is always correct).

    2) I have tried to control the page orientation using @page but that does not work.

    Here is the CSS code:
    Code:
    /*--Test stylesheet*/
    
    .cc01               { /* Common */
    	font            : 22px 'French Script MT';
    	color           : #000000;
    	}
    @page port {size: portrait;margin: 0cm}
    @page land {size: landscape;margin: 0cm}
    div#Text              { /* <DIV>Text</DIV> */
    	position        : absolute;
    	left            : 10.7cm;
    	top             : 4.2cm;
    	width           : 8cm;
    	height          : 10cm;
    	}
    This is the HTML portion of the PHP script that generates the page to printout:
    Code:
    <html>
    <head>
    <link rel="stylesheet" type="text/css" href="reset.css" media="screen,projection,print">	
    <link rel="stylesheet" type="text/css" href="Prn_ScrnDLP.css" media="screen">
    <link rel="stylesheet" type="text/css" href="printDLP.css" media="print">
    <title> List of Verses</title>
        
    </head>
    <body {page: land}>
    <div id="Text" class= "cc01" align="center">
    <p>	
    <?php
    
    ECHO $display_block;
    
    ?>
    </p>
    </div>
    </body>
    </html>
    Note:
    I have recently added a reset.css as I read this on another forum
    reset.css:
    Code:
    /* http://meyerweb.com/eric/tools/css/reset/ 
       v2.0 | 20110126
       License: none (public domain)
    */
    
    html, body, div, span, applet, object, iframe,
    h1, h2, h3, h4, h5, h6, p, blockquote, pre,
    a, abbr, acronym, address, big, cite, code,
    del, dfn, em, img, ins, kbd, q, s, samp,
    small, strike, strong, sub, sup, tt, var,
    b, u, i, center,
    dl, dt, dd, ol, ul, li,
    fieldset, form, label, legend,
    table, caption, tbody, tfoot, thead, tr, th, td,
    article, aside, canvas, details, embed, 
    figure, figcaption, footer, header, hgroup, 
    menu, nav, output, ruby, section, summary,
    time, mark, audio, video {
    	margin: 0;
    	padding: 0;
    	border: 0;
    	font-size: 100%;
    	font: inherit;
    	vertical-align: baseline;
    }
    /* HTML5 display-role reset for older browsers */
    article, aside, details, figcaption, figure, 
    footer, header, hgroup, menu, nav, section {
    	display: block;
    }
    body {
    	line-height: 1;
    }
    ol, ul {
    	list-style: none;
    }
    blockquote, q {
    	quotes: none;
    }
    blockquote:before, blockquote:after,
    q:before, q:after {
    	content: '';
    	content: none;
    }
    table {
    	border-collapse: collapse;
    	border-spacing: 0;
    }
    I would appreciate any help as I am new to CSS, HTML and PHP.

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,616
    Thanks
    0
    Thanked 645 Times in 635 Posts
    There are no such things as pixels when you print something. Possibly you meant to print it using 22pt rather than using the meaningless 22px.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • Users who have thanked felgall for this post:

    rockyhudson (01-23-2012)

  • #3
    New Coder
    Join Date
    Jan 2012
    Location
    Hastings, East Sussex, UK
    Posts
    34
    Thanks
    21
    Thanked 0 Times in 0 Posts
    Thanks Stephen!

    So simple I overlooked it!

    Any ideas on the orientation problem?

    RockyHudson

  • #4
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,616
    Thanks
    0
    Thanked 645 Times in 635 Posts
    I haven't come across anywhere that indicates that either @page port or [b}@page land[/b] are valid. The only values I know you can put before the { in a @page statement are :first :left and :right - see http://www.w3.org/TR/CSS2/page.html#page-selectors
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • Users who have thanked felgall for this post:

    rockyhudson (01-25-2012)


  •  

    Posting Permissions

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