Files
citrus-cms/app/Functions/pdf_html_content.php
T
2026-04-28 21:14:25 +03:00

131 lines
3.1 KiB
PHP
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
function bootstrap_css() {
return file_get_contents("https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css");
}
function pdf_html_content($html) {
$bootstrap = bootstrap_css();
// $html = str_replace("&nbsp;", "", $html);
$html = "<div class='pdf-container'>$html</html>";
$start = '<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
}
table {
width: 100%;
border-collapse: collapse;
}
th, td {
border: 1px solid black;
padding: 5px !important ;
text-align: left;
height:auto !important;
max-width:100px !important;
}
th {
background-color: #f2f2f2;
}
.header, .footer {
text-align: center;
font-weight: bold;
}
.subheader {
font-weight: bold;
background-color: #f9f9f9;
}
.signature {
height: 60px;
}
.checkbox {
display: inline-block;
width: 20px;
height: 20px;
border: 1px solid black;
margin-right: 5px;
}
.pdf-container {
width:100% !important;
max-width:100% !important;
}
.pdf-container { margin: 0px;
padding:0px;
width:98% !important;
}
/*
.pdf-container * {
font-family: DejaVu Sans !important;
}
*/
.pdf-container table {
border-spacing: 0;
}
.pdf-container .bordered td {
border:solid 1px #000 !important;
padding:3px;
font-size:12px !important;
}
/*
table td, table th, p, span {
font-size:12px !important;
}
*/
.pagebreak {
clear: both;
page-break-after: always;
}
td {
}
.pdf-container p, .pdf-container hr {
margin:0;
padding:0;
}
.pdf-container table {
border-collapse: revert !important;
/*
border-spacing: -1px;
border-left: 0.01em solid #ccc;
border-right: 0;
border-top: 0.01em solid #ccc;
border-bottom: 0;
border-collapse: collapse;
*/
}
.pdf-container table td,
.pdf-container table th {
/*
border-left: 0.01em solid black;
border-right: 0.01em solid black;
border-top: 0;
border-bottom: 0.01em solid black;
*/
}
.text-center * {
text-align:center;
}
</style>
</head>
<body>';
$end = "</body>
</html>";
return $start . $html . $end;
} ?>