| | |
| | | export function printHtml(html) { |
| | | export function loadPrintStyle() { |
| | | let style = getStyle(); |
| | | let container = getContainer(html); |
| | | |
| | | document.body.appendChild(style); |
| | | document.body.appendChild(container); |
| | | } |
| | | |
| | | export function printHtml(html) { |
| | | let container = getContainer(html); |
| | | document.body.appendChild(container); |
| | | getLoadPromise(container).then(() => { |
| | | window.print(); |
| | | document.body.removeChild(style); |
| | | document.body.removeChild(container); |
| | | }); |
| | | } |
| | | |
| | | |
| | | // 设置打印样式 |
| | | function getStyle() { |
| | |
| | | @page { |
| | | margin-top: 0; |
| | | margin-bottom: 0 |
| | | } |
| | | .div-2-column { |
| | | display: flex; |
| | | flex-direction: row; |
| | | justify-content: space-between; |
| | | } |
| | | .m-h2 { |
| | | text-align: center; |
| | | font-size: 1.17em; |
| | | margin-top: 50px; |
| | | font-weight: bold; |
| | | } |
| | | #tr { |
| | | height: 30px; |
| | | } |
| | | .txt-center { |
| | | text-align: center; |
| | | } |
| | | `; |
| | | let style = document.createElement("style"); |