使用react-pdf/Render库在pdf文档中呈现自定义HTML标记



我正在尝试在<View>/<Text>组件中呈现HTML,同时使用模板在<PDFViewer>组件中呈现PDF。

我想在我的pdf 中呈现我的自定义HTML标记代码,如下所示

<p><span style="font-size: 24px;">Pre Interview Notes</span></p><p><br></p><p><strong style="font-size: 14px;"><u>This is a test Pre Interview Notes:</u></strong></p><p><br></p><p><em style="font-size: 14px;">The Guest requires a wheel chair for the show</em></p><p><br></p><p><br></p>

环境

  • 浏览器[例如Chrome浏览器]:
  • React PDF版本[1.6.8]:
  • React版本[例如16.8.6]:

我使用了react-pdf-html,它很有效。

您可以考虑使用@react pdf/renderer,此库是从react pdf库扩展而来的,请访问:https://react-pdf.org/repl?example=breakable-在操场上牢不可破。希望它能有所帮助!

最新更新