将获取请求发送至:' http://localhost:4000/features' JSON数据有一个响应,里面有HTML。
我需要将字段名称和说明的内容保存为PDF
样品:
[{"_id":"5ad4951d0ba1c37c65818bc7","name":"Find your work faster","description":"<p>With an improved <strong>quick search</strong>, searching through all your issues and projects will be nothing else but a breeze. Whether you know the full issue key, part of the issue name, or just have a distant memory of a project from a year ago, start typing the words, and we’ll do the rest for you. The quick search instantly shows the most relevant results, and refreshes them whenever you change your search term.</p>\n\n<p><img alt=\"\" src=\"https://confluence.atlassian.com/jirasoftware/files/945521251/945528523/1/1518181922686/quicksearch.png\" style=\"height:400px; width:800px\" /></p>\n\n<p>If you’ve already found what you were looking for, just treat quick search as a handy work diary. Click anywhere in the box to see the issues and projects you’ve been working on recently, and have the most important work always at your fingertips.</p>\n\n<p><a href=\"https://confluence.atlassian.com/jirasoftwareserver/quick-searching-939938728.html\">Learn more</a></p>\n","__v":0},{"_id":"5ad5ddddcd054b2b5b20143c","name":"Project sidebar","description":"<p>The project sidebar that we previewed in <a href=\"https://confluence.atlassian.com/jira/jira-6-4-release-notes-678561444.html\">JIRA 6.4</a> is here to stay. We built this new navigation experience to make it easier for you to find what you need in your projects. It's even better, if you are using JIRA Agile: your backlog, sprints, and reports are now just a click away. If you've used the sidebar with JIRA Agile before, you'll notice that cross-project boards, which include multiple projects, now have a project sidebar as well — albeit a simpler version.</p>\n","__v":0}]
可以在nodeJS中完成吗?
答案 0 :(得分:0)
Conversion isn't the right word but generation is. According to the generalized response in json response you can write logic for generation of pdf from it in node-js server. PDFKit and PDFmake are two good libraries for this purpose. I've used pdfmake and is very good. See doc here: https://pdfmake.github.io/docs/
答案 1 :(得分:0)