Is it possible to generate PDF using jQuery?

后端 未结 6 772
忘掉有多难
忘掉有多难 2020-12-15 06:35

I am using Ajax functionality to retrieve my content and I need to export PDF on success of jQuery.ajax(). How can I do that?

6条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-15 07:08

    If at all possible, the server-side is a better choice for generating PDFs. It's probably going to be faster for most users and returning a file via standard HTTP request is much more robust than the current client-side options.

    That said, this library will generate a PDF on the client-side: http://snapshotmedia.co.uk/blog/jspdf

    In browsers that support data URIs, it can return the PDF directly. In other browsers, you can couple it with a Flash component called Downloadify to accomplish the same.

提交回复
热议问题