| | |
| | | // 创建一个新的打印窗口 |
| | | const printWindow = window.open('', '_blank', 'width=800,height=600'); |
| | | |
| | | // 获取打印预览内容 |
| | | const previewContent = document.querySelector('.print-preview-content').innerHTML; |
| | | // 获取打印预览内容,只提取实际的打印页面 |
| | | const printPages = document.querySelectorAll('.print-page'); |
| | | let previewContent = ''; |
| | | printPages.forEach(page => { |
| | | previewContent += page.outerHTML; |
| | | }); |
| | | |
| | | // 构建打印内容 |
| | | let printContent = ` |
| | |
| | | .print-page { |
| | | width: 241mm; |
| | | height: 75mm; |
| | | padding: 10mm; |
| | | padding-left: 20mm; |
| | | padding: 0mm 10mm; |
| | | background: white; |
| | | box-sizing: border-box; |
| | | page-break-after: always; |
| | |
| | | margin-bottom: 8px; |
| | | } |
| | | .company-name { |
| | | font-size: 18px; |
| | | font-size: 28px; |
| | | font-weight: bold; |
| | | margin-bottom: 4px; |
| | | } |
| | | .document-title { |
| | | font-size: 16px; |
| | | font-size: 25px; |
| | | font-weight: bold; |
| | | letter-spacing: 10px; |
| | | } |
| | |
| | | text-align: center; |
| | | margin-bottom: 8px; |
| | | |
| | | .company-name { |
| | | font-size: 18px; |
| | | font-weight: bold; |
| | | margin-bottom: 4px; |
| | | } |
| | | |
| | | .document-title { |
| | | font-size: 16px; |
| | | font-weight: bold; |
| | | letter-spacing: 10px; |
| | | } |
| | | .company-name { |
| | | font-size: 28px; |
| | | font-weight: bold; |
| | | margin-bottom: 4px; |
| | | } |
| | | .document-title { |
| | | font-size: 25px; |
| | | font-weight: bold; |
| | | letter-spacing: 10px; |
| | | } |
| | | } |
| | | |
| | | .info-section { |