I am trying to print a dashboard from my app. The dashboard has embedded iFrame graphs and I want to include them on the PDF.
I am using JSPDF. I am able to generate a PDF of text elements so the plugin is working correctly.
My question is how do I get the content from the iFrame. Here's where I am so far:
In my html file:
<iframe class="myiframe" v-bind:src="iframe_url"></iframe>
and my vuejs script:
import jsPDF from 'jspdf'
export default {
methods: {
downloadPDF() {
const doc = new jsPDF();
// some code...
// iFrames
vOffset + 10
doc.text(25, vOffset, 'Data Flows')
var iFrameBody = document.getElementById('myiframe')
doc.fromHTML(iFrameBody, 15, vOffset)
doc.save("sample.pdf")
}
}
}
The PDF prints correctly but is blank where the iFrame should appear.
I've searched the github repo for jsPDF and also stackoverflow for solutions but haven't found anything that works.
Any tips would be great.