added hyperlink to qr code
This commit is contained in:
parent
b525866109
commit
4688f7ea6e
2 changed files with 9 additions and 5 deletions
|
|
@ -1,4 +1,4 @@
|
|||
function execute_me() {
|
||||
function execute_me(qr_link) {
|
||||
const pdf_version = this.document.getElementById("body");
|
||||
|
||||
console.log(pdf_version);
|
||||
|
|
@ -6,16 +6,20 @@ function execute_me() {
|
|||
var opt = {
|
||||
filename: 'myfile.pdf',
|
||||
image: { type: 'jpeg', quality: 0.9 },
|
||||
html2canvas: { scale: 2, logging: true, dpi: 192, letterRendering: true, width: 1200, windowWidth: 1200 },
|
||||
html2canvas: { width: 1200, windowWidth: 1200 },
|
||||
enableLinks: false,
|
||||
jsPDF: {
|
||||
unit: 'pt',
|
||||
format: 'letter',
|
||||
orientation: 'portrait'
|
||||
orientation: 'portrait',
|
||||
},
|
||||
pagebreak: { mode: '', avoid: '.break-avoid' },
|
||||
};
|
||||
html2pdf().set(opt).from(pdf_version).toPdf().get('pdf').then(function(pdf) {
|
||||
var totalPages = pdf.internal.getNumberOfPages();
|
||||
pdf.setPage(1);
|
||||
pdf.link(530, 25, 60, 60, { url: qr_link });
|
||||
|
||||
for (i = 1; i <= totalPages; i++) {
|
||||
pdf.setPage(i);
|
||||
pdf.setFontSize(10);
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@
|
|||
<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" style="margin-right: -100pt" id="download-pdf" onclick="execute_me()">Download PDF</button>
|
||||
<a href="{{ qr_code.link }}" id="pdf-qr-code" class="align-self-center" style="margin-right: 1%; visibility: hidden; border: 1px red solid;"><img style="width:100pt;" id="qr_code" src="{{ qr_code.image }}"/></a>
|
||||
<button type="button" class="btn btn-outline-dark align-self-center" style="margin-right: -100pt" id="download-pdf" onclick="execute_me('{{qr_code.link}}')">Download PDF</button>
|
||||
<img id="pdf-qr-code" class="align-self-center" style="margin-right: 1%; visibility: hidden; width:100pt;" src="{{ qr_code.image }}"/>
|
||||
</div>
|
||||
|
||||
{% endblock report_header %}
|
||||
|
|
|
|||
Loading…
Reference in a new issue