diff --git a/cara/apps/calculator/static/css/report.css b/cara/apps/calculator/static/css/report.css index 166b3cb8..5373033b 100644 --- a/cara/apps/calculator/static/css/report.css +++ b/cara/apps/calculator/static/css/report.css @@ -98,18 +98,28 @@ p.notes { margin-right: 1%; } -@media screen { - .card_break { - display: none!important; - } -} - #rules, #data { display: none!important; } @media (width: 1200px) { + /* CSS styling for break avoid. */ + .break-avoid { + page-break-inside: avoid; + } + .first_page { + height: 370pt; + } + .second_page { + height: 500pt; + } + .third_page { + height: 100pt; + } + .fourth_page { + height: 650pt; + } .collapse { display: block!important; } @@ -134,6 +144,9 @@ p.notes { .print-button { display: none!important; } + #link_reproduce_results { + display: none!important; + } } diff --git a/cara/apps/calculator/static/js/pdf.js b/cara/apps/calculator/static/js/pdf.js index e59f7612..18f3e642 100644 --- a/cara/apps/calculator/static/js/pdf.js +++ b/cara/apps/calculator/static/js/pdf.js @@ -8,11 +8,11 @@ function execute_me() { image: { type: 'jpeg', quality: 0.9 }, html2canvas: { scale: 2, logging: true, dpi: 192, letterRendering: true, width: 1200, windowWidth: 1200 }, jsPDF: { - unit: 'mm', - format: 'a4', + unit: 'pt', + format: 'letter', orientation: 'portrait' }, - pagebreak: { mode: 'avoid-all', after: ['#rules', '#results'] } + pagebreak: { mode: '', avoid: '.break-avoid' }, }; html2pdf().set(opt).from(pdf_version).toPdf().get('pdf').then(function(pdf) { var totalPages = pdf.internal.getNumberOfPages(); @@ -20,7 +20,7 @@ function execute_me() { pdf.setPage(i); pdf.setFontSize(10); pdf.setTextColor(150); - pdf.text('Page ' + i + ' of ' + totalPages, (pdf.internal.pageSize.getWidth() / 2.25, (pdf.internal.pageSize.getHeight() - 8))); + pdf.text('Page ' + i + ' of ' + totalPages, (pdf.internal.pageSize.getWidth() / 2.25), (pdf.internal.pageSize.getHeight() - 10)); } }) .save(); diff --git a/cara/apps/calculator/templates/base/calculator.report.html.j2 b/cara/apps/calculator/templates/base/calculator.report.html.j2 index 9c9909a6..ba7f8416 100644 --- a/cara/apps/calculator/templates/base/calculator.report.html.j2 +++ b/cara/apps/calculator/templates/base/calculator.report.html.j2 @@ -24,7 +24,6 @@ -
{% endblock report_header %} @@ -87,7 +86,8 @@ - + +