How to get correct rendering size when printing html elements

前端 未结 3 987
忘了有多久
忘了有多久 2021-02-08 10:41

I have trouble understanding how to render html elements with correct size when printing them to A4 size paper.

To illustrate my purpose, I simplified my code to a html

3条回答
  •  [愿得一人]
    2021-02-08 11:10

    You could use phantomjs to render your pdf (you ask for pdf eventually). In php I have successfully used https://github.com/kriansa/h2p to generate pdf's. (also with rendering javascript based charts with d3.js). It is not easy but with headless browsing you can make it work.

提交回复
热议问题