我正在写一份报告,工作人员在PHP
网站上浏览,完成后打印出来.这一切都相当简单;然而,当它打印出来时,我希望它的尺寸比工作人员使用的46英寸宽屏小,这样table
s就可以清晰地显示在每一页上...
我的normal CSS
是这样的:
div#reportPage {
display: flex;
flex-direction: column;
align-items: center;
}
table#report {
border-collapse: collapse;
margin-bottom: 25px;
}
table#report>thead>tr>th,
table#report>tbody>tr>td {
border: 1px solid white;
padding: 5px;
}
table#report>thead>tr>th.pt {
font-size: 1.25em;
}
th.dn::after {
white-space: pre;
content: "\A Alt Name";
font-size: 0.8em;
font-style: italic;
}
th.prov>p {
font-size: 0.8em;
font-style: italic;
margin: 0px;
padding: 2px;
}
PHP
/HTML
function weeklyTable($patient)
{
include "system/connect.php";
try {
$regData = $conn->query("SELECT * FROM `medications` WHERE `status` = 1 AND `patient` = '$patient' AND `type` = 1 ORDER BY `name` ASC")->fetchAll();
echo "<table id='report'>";
echo "<thead><tr><th colspan=99 class='pt'>$patient - Standard Meds</th></tr>
<tr><th class='dn'>Drug Name</th><th>Rx #</th><th class='prov'>Provider<p>Department</p></th><th>Dose/Pill</th>
<th>Q/F</th><th>TOD</th><th>Su</th><th>M</th><th>Tu</th><th>W</th><th>Th</th><th>F</th><th>Sa</th></tr></thead>";
foreach ($regData as $rx) {
if ($rx['type'] == 1) {
}
}
echo "</table>";
$regData = $conn->query("SELECT * FROM `medications` WHERE `status` = 1 AND `patient` = '$patient' AND `type` = 2 ORDER BY `name` ASC")->fetchAll();
echo "<table id='report'>";
echo "<thead><tr><th colspan=99 class='pt'>$patient - Advanced Meds</th></tr>
<tr><th class='dn'>Drug Name</th><th>Rx #</th><th class='prov'>Provider<p>Department</p></th><th>Dose/Pill</th>
<th>Q/F</th><th>TOD</th><th>Su</th><th>M</th><th>Tu</th><th>W</th><th>Th</th><th>F</th><th>Sa</th></tr></thead>";
foreach ($regData as $rx) {
if ($rx['type'] == 1) {
}
}
echo "</table>";
$regData = $conn->query("SELECT * FROM `medications` WHERE `status` = 1 AND `patient` = '$patient' AND `type` = 3 ORDER BY `name` ASC")->fetchAll();
echo "<table id='report'>";
echo "<thead><tr><th colspan=99 class='pt'>$patient - OTC Meds</th></tr>
<tr><th class='dn'>Drug Name</th><th>Rx #</th><th class='prov'>Provider<p>Department</p></th><th>Dose/Pill</th>
<th>Q/F</th><th>TOD</th><th>Su</th><th>M</th><th>Tu</th><th>W</th><th>Th</th><th>F</th><th>Sa</th></tr></thead>";
foreach ($regData as $rx) {
if ($rx['type'] == 1) {
}
}
echo "</table>";
echo "<br/><br/>";
} catch (PDOException $e) {
echo "PDOError: {$e->getMessage()}";
die();
} catch (Exception $e) {
echo "ExceptionError: {$e->getMessage()}";
}
}
我还在做桌子之类的东西,所以如果你看到里面有什么愚蠢的东西,请不要担心,我真的复制并粘贴了第一个多次.
所以我的"正常"font-size
是1em(除了少数例外)...如果我想在ALL个项目上以0.75的修改量(原始字体大小的75%)打印,包括1.25em和0.8em的项目-除了重新编码css之外,还有没有一种干净的方法可以做到这一点(我已经在做@media print
了,所以请不要认为我忘记了这一点)?
此外,无需担心注入-这是我们方面的所有输入,并在那里验证/prepared
.