Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I need to create a PDF from HTML inside a react-js app.

Many packages I have found prompt a download button in the browser ( like jsPDF ), but I actually need the PDF as a binary string. I need this string to be send to a private API that stores this PDF ( binary string ) in S3 as a PDF file. This private API call already exists, and I can not change anything from this code.

I am struggeling to understand why this is so hard. How would you go about converting HTML to PDF binary string? Thanks for any suggestions, packages, ... It can be javscript, if I can implement it inside my reactJS app.

Bonus points if the solution can accept HTML tags, since the input is done inside an WYSIWYG editor.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
149 views
Welcome To Ask or Share your Answers For Others

1 Answer

This server side solution works with any HTML framework. https://github.com/PDFTron/web-to-pdf

This is from the company I work for, but is AGPL-3.0 so you should be able to use no problem.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...