0

so I have this huge data table and I want to fit them all when I print it in a legal size paper. Right now all I have is the size of the paper but the content does not fit to it

Here is my CSS codes:

@page {
  size:  legal;
}
@page :left {
  margin: 0.5cm;
}

@page :right {
  margin: 0.5cm;
}

and here is my table:

<div class="table-responsive">
<table border="1" style="table-layout: fixed;" align="center">
  <caption class="center">PERSONAL</caption>
  <tr>
    <th align="left">NAME: </th>
    <td colspan="3"><input type="text" name="full_name" size="37" value="<?php echo $full_name; ?>" disabled></td>
    <th colspan="1" align="left">MOBILE: </th>
    <td><input type="text" name="phone_number" size="11" value="<?php echo $phone_number; ?>" disabled></td>
    <th align="left">RANK: </th>
    <td><input type="text" name="crew_rank" size="10" value="<?php echo $crew_rank; ?>" disabled></td>
  </tr>
  <tr>
    <th align="left">DATE OF BIRTH: </th>
    <td><input type="text" name="date_of_birth" size="17" value="<?php echo $date_of_birth; ?>" disabled></td>
    <th align="left">AGE: </th>
    <td><input type="text" name="age" size="5" value="<?php echo $age; ?>" disabled></td>
    <th align="left">TELEPHONE NUMBER: </th>
    <td><input type="text" name="telephone_number" size="11" value="<?php echo $telephone_number; ?>" disabled></td>
    <th align="left">VESSEL: </th>
    <td><input type="text" name="vessel" size="10" value="<?php echo $vessel; ?>" disabled></td>
  </tr>
  <tr>
    <th align="left">PLACE OF BIRTH: </th>
    <td colspan="3"><input type="text" name="place_of_birth" size="37" value="<?php echo $place_of_birth; ?>" disabled></td>
    <th colspan="1" align="left">RELIGION: </th>
    <td><input type="text" name="religion" size="11" value="<?php echo $religion; ?>" disabled></td>
    <th align="left">JOINING DATE: </th>
    <td><input type="text" name="joining_date" size="10" value="<?php echo $joining_date; ?>" disabled></td>
  </tr>
  <tr>
    <th align="left">CITIZENSHIP/CIVIL STATUS</th>
    <td><input type="text" name="citizenship" size="17" value="<?php echo $citizenship; ?>" disabled></td>
    <td colspan="2"><input type="text" name="civil_status" size="16" value="<?php echo $civil_status; ?>" disabled></td>
    <th colspan="1" align="left">SSS No.</th>
    <td colspan="1"><input type="text" name="sss_number" size="11" value="<?php echo $sss_number; ?>" disabled></td>
    <th align="left">JOINING PORT: </th>
    <td colspan="2"><input type="text" name="joining_port" size="10" value="<?php echo $joining_port; ?>" disabled></td>
  </tr>
  <tr>
    <th align="left">SHOES/BOILER SUIT SIZE</th>
    <td><input type="text" name="shoe_size" size="17" value="<?php echo $shoe_size; ?>" disabled></td>
    <td><input type="text" name="boiler_size" size="5" value="<?php echo $boiler_size; ?>" disabled></td>
    <th align="left">HT/WT</th>
    <td><input type="text" name="ht" size="19" value="<?php echo $ht; ?>" disabled></td>
    <td><input type="text" name="wt" size="11" value="<?php echo $wt; ?>" disabled></td>
    <th>LAST VESSEL: </th>
    <td><input type="text" name="last_vessel" size="10" value="<?php echo $last_vessel; ?>" disabled></td>
  </tr>
  <tr>
    <th align="left">ADDRESS: </th>
    <td colspan="7" align="center"><input type="text" name="address" size="111" value="<?php echo $address; ?>" disabled></td>
  </tr>
</table>

Note: I did not include all the data in table

1 Answers1

0

Assuming the table can fit to a single page you could use print media queries.

@print{
.table-responsive:{
height:95%;
}
}
Niles Tanner
  • 3,911
  • 2
  • 17
  • 29
  • oh it did worked. thanks. one more question, how can i break the table columns when printing? – marilee arconada Sep 04 '16 at 15:45
  • One of the first links in the search I gave you. Please investigate some and ask one question at a time: http://stackoverflow.com/questions/26777317/printing-html-table-with-many-columns-rows-using-css-layout – mplungjan Sep 04 '16 at 15:50