rocky48 Posted January 18, 2012 Share Posted January 18, 2012 I am extracting a string from a MySQL database using a PHP script to query the database and within this PHP code embeded in it is some HTML code to display and print it out. It is important where it is printed on the sheet of paper, so I have written some CSS code to control its position size and orientation. The code recognises the Font face, but ignores the size I have specified. Also I need to set the paper orientation but it ignores this as well. I am not sure about the syntax in the HTML code for the orientation. Can anyone help me? CSS script: /*--Print stylesheet*/ .cc01 { /* Common */ font : 24px '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 : 0.8cm; top : 13.5cm; width : 10.0cm; height : 5.5cm; } Here is the HTML portion of the PHP script: <html> <head> <link rel="stylesheet" type="text/css" href="Prn_Scrn120SQL.css" media="screen"> <link rel="stylesheet" type="text/css" href="print120SQL.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> Quote Link to comment https://forums.phpfreaks.com/topic/255296-font-size-orientation-ignored-in-html-code/ Share on other sites More sharing options...
Ivan Ivković Posted January 25, 2012 Share Posted January 25, 2012 Try: .cc01 { /* Common */ font : 24px 'French Script MT' !important; color : #000000; } or .cc01 { /* Common */ font-family : 'French Script MT' !important; font-size : 24px; color : #000000; } Quote Link to comment https://forums.phpfreaks.com/topic/255296-font-size-orientation-ignored-in-html-code/#findComment-1311193 Share on other sites More sharing options...
rocky48 Posted January 25, 2012 Author Share Posted January 25, 2012 Hi Ivan Actually someone from another forum came up with the answer to the Font problem - It was solved by changing the font size to pt (point). However I still do not have any answer to how to get it to print in the right orientation. Have you any ideas? Rocky48 Quote Link to comment https://forums.phpfreaks.com/topic/255296-font-size-orientation-ignored-in-html-code/#findComment-1311198 Share on other sites More sharing options...
Ivan Ivković Posted January 25, 2012 Share Posted January 25, 2012 Hi Ivan Actually someone from another forum came up with the answer to the Font problem - It was solved by changing the font size to pt (point). However I still do not have any answer to how to get it to print in the right orientation. Have you any ideas? Rocky48 Yea that may be because 'font' accepts only PT, while font-size can accept px, em, pt... You can't actually align it to center if you entered position: absolute; and stuff... These are possible solutions to orientation: <center> <div id="Text" class= "cc01"> <p> <?php ECHO $display_block; ?> </p> </div> </center> <div style='text-align: center;'> <div id="Text" class= "cc01"> <p> <?php ECHO $display_block; </div> ?> </p> </div> div#Text{ float: center; } Quote Link to comment https://forums.phpfreaks.com/topic/255296-font-size-orientation-ignored-in-html-code/#findComment-1311242 Share on other sites More sharing options...
Ivan Ivković Posted January 25, 2012 Share Posted January 25, 2012 Remove this part? div#Text { /* <DIV>Text</DIV> */ position : absolute; left : 0.8cm; top : 13.5cm; width : 10.0cm; height : 5.5cm; } Quote Link to comment https://forums.phpfreaks.com/topic/255296-font-size-orientation-ignored-in-html-code/#findComment-1311243 Share on other sites More sharing options...
Solution rocky48 Posted January 25, 2012 Author Solution Share Posted January 25, 2012 Hi Ivan That would through all the positioning I have carefully worked out. Just to elabourate, I am trying to produce a utility to print out greetings inserts for handmade cards. The position that it prints out is critical, as for an A5 portrait insert it must print Landscape in the righthand half of the page and so it looks right it is centred with the box. This part is working OK! I just need to orientate the page. I have just found a php script to output as PDF, so I am investigating this! Thanks for your help! Rocky48 Quote Link to comment https://forums.phpfreaks.com/topic/255296-font-size-orientation-ignored-in-html-code/#findComment-1311247 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.