all tabs in one file pdf version

This commit is contained in:
Luis Aleixo 2021-08-18 21:37:21 +02:00
parent d06528e5b4
commit 0e374499c2
4 changed files with 29 additions and 23 deletions

View file

@ -4,7 +4,7 @@
bottom: 20px;
right: 20px;
padding: 20px;
min-width: 1300px;
min-width: 1200px;
}
h1 {
@ -104,12 +104,18 @@ p.notes {
}
}
@media screen and (max-width: 1301px) {
#rules,
#data {
display: none!important;
}
@media (width: 1200px) {
.collapse {
display: block!important;
}
.tab-content>.tab-pane {
display: contents!important;
#rules,
#data {
display: inline!important;
}
.tab-content {
border-top: none!important;

View file

@ -1,17 +1,17 @@
window.onload = function() {
document.getElementById("download-pdf")
.addEventListener("click", () => {
const pdf_version = this.document.getElementById("body");
function execute_me() {
const pdf_version = this.document.getElementById("body");
console.log(pdf_version);
console.log(window);
var opt = {
margin: 0,
filename: 'myfile.pdf',
image: { type: 'jpeg', quality: 0.98 },
html2canvas: { scale: 2, letterRendering: true, width: 1300 },
jsPDF: { format: 'a4', orientation: 'portrait' },
};
html2pdf().from(pdf_version).set(opt).save();
})
}
console.log(pdf_version);
console.log(window);
var opt = {
filename: 'myfile.pdf',
image: { type: 'jpeg', quality: 0.9 },
html2canvas: { scale: 2, width: 1200, windowWidth: 1200 },
jsPDF: {
format: 'a4',
orientation: 'portrait'
},
pagebreak: { after: '.page-break' }
};
const pdf = html2pdf().set(opt).from(pdf_version).outputImg().save();
};

View file

@ -22,7 +22,7 @@
<h2 class="text-component-title" style="margin-bottom: 0">CARA - CALCULATOR REPORT</h1>
<p style="margin-bottom: 0"> Created {{ creation_date }} using CARA calculator version v{{ form.calculator_version }}</p>
</div>
<button type="button" class="btn btn-outline-dark align-self-center print-button" id="download-pdf">Download PDF</button>
<button type="button" class="btn btn-outline-dark align-self-center print-button" id="download-pdf" onclick="execute_me()">Download PDF</button>
</div>
{% endblock report_header %}
@ -163,7 +163,7 @@
{% endblock report_footer %}
</div>
<div class="tab-pane fade" id="data" role="tabpanel" aria-labelledby="data-tab" style="padding: 1%">
<div class="tab-pane fade show active" id="data" role="tabpanel" aria-labelledby="data-tab" style="padding: 1%">
{% block simulation_overview %}
<br class="card_break">
<div class=card>

View file

@ -107,7 +107,7 @@
{% block report_preamble %}
<br class="card_break">
<div class="tab-pane fade" id="rules" role="tabpanel" aria-labelledby="rules-tab" style="padding: 1%">
<div class="tab-pane fade show active" id="rules" role="tabpanel" aria-labelledby="rules-tab" style="padding: 1%">
<div class="card bg-light mb-3">
<div class="card-header"><strong>Applicable rules </strong>
<button class="icon_button p-0 float-right" data-toggle="collapse" href="#collapseRules" role="button" aria-expanded="true" aria-controls="collapseRules">