简体   繁体   中英

Export html to pdf with d3 charts and photos

I want to export HTML to PDF with JavaScript, and I tried jsPdf with html2canvas, but not all the charts can show up and photos can't appear.I know html2canvas uses canvas to simulate dom content, so it can't perfectly simulate all the content.Is any other method? Thanks! The following is the pdf result:

在此处输入图片说明

expected result 在此处输入图片说明

Apache has a library called Apache batik .It convert SVG image to raster format pdf/png/word etc. Its difficult to convert svg element directly from the UI into raster format. Batik is a best approach to implement. It has been implemented is in java .

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