简体   繁体   中英

Can I export iframe to pdf with javascript

I am need export pdf a iframe in javascript but it have token authorization, I can not obtaing a html.

<iframe type="application/pdf" width="600" height="373.5" src="https://app.powerbi.com/view?r=eyJrIjoiNjk1MzdjNmQtZThmYi00MjQwLWFiODItZTlhZTJiZWJiODU1IiwidCI6IjQyZDlhY2FhLTVhYTItNDhiMy04MDgxLTRlMTgzODdmMWVkNSIsImMiOjF9&pageName=ReportSection" frameborder="0" allowFullScreen="true">
</iframe>

Though there are -ridiculously intricate and inefficient- ways to do so, seeing that what you are trying to produce as PDF is a Power BI report/view, the best way to do it is to use PowerBI Export API

Detailed instructions and manual can be found here: https://powerbi.microsoft.com/en-us/blog/export-report-to-pdf-pptx-and-png-files-using-power-bi-rest-api/

You may need a Javascript library for this. Check out JSPDF: https://github.com/MrRio/jsPDF .

You could also look at this post: Using jsPDF to create a PDF from an iframe

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM