Fix various issues with bold and modern PDF designs

This commit is contained in:
Joshua Dwire 2021-10-05 17:42:41 -04:00
parent fcffafea9d
commit d68040897f
2 changed files with 208 additions and 227 deletions

View File

@ -13,8 +13,13 @@
zoom: 80%; zoom: 80%;
} }
body, html {
margin: 0;
padding: 0;
}
@page { @page {
margin: -0.25cm !important; margin: 0 -5px !important;
size: $page_size $page_layout; size: $page_size $page_layout;
} }
@ -24,20 +29,32 @@
/* page-break-after: always; */ /* page-break-after: always; */
} }
.header-wrapper { #spacer-table > * > tr > td {
padding: 0;
}
#header {
display: grid; display: grid;
grid-template-columns: 1.5fr 1fr 1fr; grid-template-columns: 1.5fr 1fr 1fr;
gap: 20px; gap: 20px;
background-color: #2d2c2a; background-color: #2d2c2a;
padding: 3rem;
color: white; color: white;
min-width: 100%;
line-height: var(--line-height); line-height: var(--line-height);
position: fixed;
top: 0;
}
#header, #header-spacer {
height: 160px;
padding: 3rem;
margin-bottom: 3rem;
} }
.company-logo { .company-logo {
height: 100%; height: 100%;
padding-right: 120px; max-width: 100%;
object-fit: contain;
object-position: left center;
} }
#company-details, #company-details,
@ -46,6 +63,12 @@
flex-direction: column; flex-direction: column;
} }
#company-details,
#company-address,
.logo-container {
max-height: 160px;
}
#client-details { #client-details {
margin: 2rem; margin: 2rem;
display: flex; display: flex;
@ -61,7 +84,6 @@
display: grid; display: grid;
grid-template-columns: 1.5fr 1fr; grid-template-columns: 1.5fr 1fr;
padding-left: 1rem; padding-left: 1rem;
padding-top: 3rem;
} }
.entity-details-wrapper { .entity-details-wrapper {
@ -138,23 +160,23 @@
gap: 80px; gap: 80px;
} }
#table-totals .totals-table-right-side>* { #table-totals .totals-table-right-side > * {
display: grid; display: grid;
grid-template-columns: 1fr 1fr; grid-template-columns: 1fr 1fr;
} }
#table-totals>.totals-table-right-side>*> :nth-child(1) { #table-totals > .totals-table-right-side > * > :nth-child(1) {
text-align: "$dir_text_align"; text-align: "$dir_text_align";
margin-top: .75rem; margin-top: .75rem;
} }
#table-totals>.totals-table-right-side> * > :not([hidden]) ~ :not([hidden]) { #table-totals > .totals-table-right-side > * > :not([hidden]) ~ :not([hidden]) {
--tw-space-y-reverse: 0; --tw-space-y-reverse: 0;
margin-top: calc(.75rem * calc(1 - var(--tw-space-y-reverse))); margin-top: calc(.75rem * calc(1 - var(--tw-space-y-reverse)));
margin-bottom: calc(.75rem * var(--tw-space-y-reverse)); margin-bottom: calc(.75rem * var(--tw-space-y-reverse));
} }
#table-totals>.totals-table-right-side>*> :nth-child(2) { #table-totals > .totals-table-right-side > * > :nth-child(2) {
text-align: right; text-align: right;
} }
@ -186,51 +208,40 @@
font-size: 1.5rem; font-size: 1.5rem;
} }
.footer-wrapper { #footer {
margin-top: 1rem; margin-top: 1rem;
background-color: #2d2c2a; background-color: #2d2c2a;
height: 160px;
min-width: 100%; min-width: 100%;
position: fixed; position: fixed;
bottom: 0; bottom: 0;
padding: 1rem 3rem;
display: grid; display: grid;
grid-template-columns: 1fr 1fr 1fr; grid-template-columns: 1fr 1fr 1fr;
gap: 15px; gap: 15px;
color: white; color: white;
} }
#footer, #footer-spacer {
height: 160px;
padding: 1rem 3rem;
margin-top: 3rem;
}
[data-ref="total_table-footer"] { [data-ref="total_table-footer"] {
padding-top: 0.5rem padding-top: 0.5rem
} }
/** Repeating header & footer styling. */
table { table {
width: 100%; width: 100%;
} }
table.print-content {} table[data-ref="table"] th,
table[data-ref="table"] td {
table.print-content th,
table.print-content td {
padding: .2rem .4rem; padding: .2rem .4rem;
text-align: left; text-align: left;
vertical-align: top; vertical-align: top;
border-top: 1px solid #dee2e6; border-top: 1px solid #dee2e6;
} }
@media print {
.print-footer {
position: fixed;
bottom: 0;
left: 0;
}
.no-print {
display: none
}
}
/** Markdown-specific styles. **/ /** Markdown-specific styles. **/
#product-table h3, #product-table h3,
#task-table h3, #task-table h3,
@ -253,10 +264,6 @@
white-space: nowrap; white-space: nowrap;
} }
.logo-container {
max-height: 160px;
}
#statement-invoice-table-totals > p { #statement-invoice-table-totals > p {
margin-right: 2rem; margin-right: 2rem;
margin-top: 1rem; margin-top: 1rem;
@ -292,24 +299,25 @@
/** To find out selectors on your own: https://invoiceninja.github.io/docs/custom-fields/#snippets **/ /** To find out selectors on your own: https://invoiceninja.github.io/docs/custom-fields/#snippets **/
</style> </style>
<table> <div id="header">
<!-- Start Header -->
<thead>
<tr>
<td>
<div class="header-wrapper" id="header">
<div class="logo-container"> <div class="logo-container">
<img class="company-logo" src="$company.logo" alt="$company.name logo"/> <img class="company-logo" src="$company.logo" alt="$company.name logo"/>
</div> </div>
<div id="company-details"></div> <div id="company-details"></div>
<div id="company-address"></div> <div id="company-address"></div>
</div> </div>
<div id="body">
<table id="spacer-table">
<thead>
<tr>
<td>
<div id="header-spacer"></div>
</td> </td>
</tr> </tr>
</thead> </thead>
<!-- End Header --> <tbody>
<tr> <tr>
<td id="body"> <td>
<div class="client-entity-wrapper"> <div class="client-entity-wrapper">
<div class="client-wrapper-left-side"> <div class="client-wrapper-left-side">
<h4 class="entity-label">$entity_label</h4> <h4 class="entity-label">$entity_label</h4>
@ -324,41 +332,35 @@
</div> </div>
<!-- Start Print Content --> <!-- Start Print Content -->
<table id="product-table" cellspacing="0" class="print-content" data-ref="table"></table> <table id="product-table" cellspacing="0" data-ref="table"></table>
<table id="task-table" cellspacing="0" class="print-content" data-ref="table"></table> <table id="task-table" cellspacing="0" data-ref="table"></table>
<table id="delivery-note-table" cellspacing="0" class="print-content" data-ref="table"></table> <table id="delivery-note-table" cellspacing="0" data-ref="table"></table>
<table id="statement-invoice-table" cellspacing="0" class="print-content" data-ref="table"></table> <table id="statement-invoice-table" cellspacing="0" data-ref="table"></table>
<div id="statement-invoice-table-totals" data-ref="statement-totals"></div> <div id="statement-invoice-table-totals" data-ref="statement-totals"></div>
<table id="statement-payment-table" cellspacing="0" class="print-content" data-ref="table"></table> <table id="statement-payment-table" cellspacing="0" data-ref="table"></table>
<div id="statement-payment-table-totals" data-ref="statement-totals"></div> <div id="statement-payment-table-totals" data-ref="statement-totals"></div>
<table id="statement-aging-table" cellspacing="0" class="print-content" data-ref="table"></table> <table id="statement-aging-table" cellspacing="0" data-ref="table"></table>
<div id="statement-aging-table-totals" data-ref="statement-totals"></div> <div id="statement-aging-table-totals" data-ref="statement-totals"></div>
<!-- End Print Content --> <!-- End Print Content -->
</td>
</tr>
<tr>
<td>
<div id="table-totals" cellspacing="0"></div> <div id="table-totals" cellspacing="0"></div>
</td> </td>
</tr> </tr>
<!-- Start Space For Footer --> </tbody>
<tfoot> <tfoot>
<tr> <tr>
<td style="height: 180px"> <td>
<!-- Leave this empty and don't remove it. This space is where footer placed on print. --> <div id="footer-spacer"></div>
</td> </td>
</tr> </tr>
</tfoot> </tfoot>
<!-- End Space For Footer --> </table>
</table> </div>
<div id="footer">
<!-- Start Footer -->
<div class="footer-wrapper print-footer" id="footer">
<div> <div>
<p data-ref="total_table-footer">$entity_footer</p> <p data-ref="total_table-footer">$entity_footer</p>
@ -381,4 +383,3 @@
<div> <!-- #2 column --> </div> <div> <!-- #2 column --> </div>
<div> <!-- #3 column --> </div> <div> <!-- #3 column --> </div>
</div> </div>
<!-- End Footer -->

View File

@ -9,37 +9,44 @@
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
font-family: Arial, Helvetica, sans-serif; font-family: Arial, Helvetica, sans-serif;
font-size: "7px"; font-size: "7px";
margin: 0;
padding: 0;
zoom: 80%; zoom: 80%;
} }
body, html {
margin: 0;
padding: 0;
}
@page { @page {
margin: -0.22cm; margin: 0 -5px !important;
size: A4 portrait; size: $page_size $page_layout;
} }
p { p {
margin: 0; margin: 0;
padding: 0; padding: 0;
/* page-break-after: always; */
} }
.header-container { #header {
background-color: var(--primary-color); background-color: var(--primary-color);
color: white; color: white;
display: grid; display: grid;
grid-template-columns: 1.5fr 1fr; grid-template-columns: 1.5fr 1fr;
padding: 3rem; position:fixed;
min-width: 100%; top: 0;
}
#header, #header-spacer {
height: 160px; height: 160px;
padding: 3rem;
margin-bottom: 3rem;
} }
.company-name { .company-name {
text-align: left; text-align: left;
} }
.header-container .company-name { #header .company-name {
font-size: 2rem; font-size: 2rem;
} }
@ -55,7 +62,7 @@
} }
.logo-client-wrapper { .logo-client-wrapper {
margin: 3rem 2rem; margin: 0 2rem 3rem;
display: grid; display: grid;
grid-template-columns: 1.5fr 1fr; grid-template-columns: 1.5fr 1fr;
} }
@ -121,17 +128,20 @@
text-align: right; text-align: right;
} }
.footer-wrapper { #footer {
margin-top: 1rem;
background-color: var(--primary-color); background-color: var(--primary-color);
padding-left: 3rem;
padding-right: 3rem;
height: 220px;
width: 100%; width: 100%;
position: fixed; position: fixed;
bottom: 0; bottom: 0;
} }
#footer, #footer-spacer {
height: 220px;
padding: 1rem 3rem;
margin-top: 1rem;
}
.footer-content { .footer-content {
display: flex; display: flex;
gap: 20px; gap: 20px;
@ -226,34 +236,18 @@
margin-bottom: 2rem; margin-bottom: 2rem;
} }
/** Repeating header & footer styling. */
table { table {
width: 100%; width: 100%;
} }
table.print-content { table[data-ref="table"] th,
} table[data-ref="table"] td {
table.print-content th,
table.print-content td {
padding: 0.2rem 0.4rem; padding: 0.2rem 0.4rem;
text-align: left; text-align: left;
vertical-align: top; vertical-align: top;
border-top: 1px solid #dee2e6; border-top: 1px solid #dee2e6;
} }
@media print {
.print-footer {
position: fixed;
bottom: 0;
left: 0;
}
.no-print {
display: none;
}
}
/** Markdown-specific styles. **/ /** Markdown-specific styles. **/
#product-table h3, #product-table h3,
#task-table h3, #task-table h3,
@ -306,70 +300,57 @@
/** For more info, please check our docs: https://invoiceninja.github.io **/ /** For more info, please check our docs: https://invoiceninja.github.io **/
/** To find out selectors on your own: https://invoiceninja.github.io/docs/custom-fields/#snippets **/ /** To find out selectors on your own: https://invoiceninja.github.io/docs/custom-fields/#snippets **/
</style> </style>
<div id="header">
<table> <h1 class="company-name">$company.name</h1>
<!-- Start Header --> <table id="entity-details" cellspacing="0" dir="$dir"></table>
</div>
<div id="body">
<table id="spacer-table">
<thead> <thead>
<tr> <tr>
<td> <td>
<div class="header-container" id="header"> <div id="header-spacer"></div>
<h1 class="company-name">$company.name</h1>
<table id="entity-details" cellspacing="0" dir="$dir"></table>
</div>
</td> </td>
</tr> </tr>
</thead> </thead>
<!-- End Header --> <tbody>
<tr>
<td id="body">
<div class="logo-client-wrapper">
<img
class="company-logo"
src="$company.logo"
alt="$company.name logo"
/>
<div id="client-details"></div>
</div>
<!-- Start Print Content -->
<div class="table-wrapper">
<table id="product-table" cellspacing="0" class="print-content" data-ref="table"></table>
<table id="task-table" cellspacing="0" class="print-content" data-ref="table"></table>
<table id="delivery-note-table" cellspacing="0" class="print-content" data-ref="table"></table>
<table id="statement-invoice-table" cellspacing="0" class="print-content" data-ref="table"></table>
<div id="statement-invoice-table-totals" data-ref="statement-totals"></div>
<table id="statement-payment-table" cellspacing="0" class="print-content" data-ref="table"></table>
<div id="statement-payment-table-totals" data-ref="statement-totals"></div>
<table id="statement-aging-table" cellspacing="0" class="print-content" data-ref="table"></table>
<div id="statement-aging-table-totals" data-ref="statement-totals"></div>
</div>
<!-- End Print Content -->
</td>
</tr>
<tr> <tr>
<td> <td>
<div class="logo-client-wrapper">
<img class="company-logo" src="$company.logo" alt="$company.name logo"/>
<div id="client-details"></div>
</div>
<div class="table-wrapper">
<table id="product-table" cellspacing="0" data-ref="table"></table>
<table id="task-table" cellspacing="0" data-ref="table"></table>
<table id="delivery-note-table" cellspacing="0" data-ref="table"></table>
<table id="statement-invoice-table" cellspacing="0" data-ref="table"></table>
<div id="statement-invoice-table-totals" data-ref="statement-totals"></div>
<table id="statement-payment-table" cellspacing="0" data-ref="table"></table>
<div id="statement-payment-table-totals" data-ref="statement-totals"></div>
<table id="statement-aging-table" cellspacing="0" data-ref="table"></table>
<div id="statement-aging-table-totals" data-ref="statement-totals"></div>
</div>
<div id="table-totals" cellspacing="0"></div> <div id="table-totals" cellspacing="0"></div>
</td> </td>
</tr> </tr>
<!-- Start Space For Footer --> </tbody>
<tfoot> <tfoot>
<tr> <tr>
<td style="height: 230px"> <td>
<!-- Leave this empty and don't remove it. This space is where footer placed on print --> <div id="footer-spacer"></div>
</td> </td>
</tr> </tr>
</tfoot> </tfoot>
<!-- End Space For Footer --> </table>
</table> </div>
<!-- Start Footer --> <div id="footer">
<div class="footer-wrapper print-footer" id="footer">
<div class="footer-content"> <div class="footer-content">
<div> <div>
<p data-ref="total_table-footer">$entity_footer</p> <p data-ref="total_table-footer">$entity_footer</p>
@ -396,4 +377,3 @@
</div> </div>
</div> </div>
</div> </div>
<!-- End Footer -->