@accoio/react-pdf-highlighter 中文文档教程

发布于 6年前 浏览 15 项目主页 更新于 3年前

react-pdf-highlighter

react-pdf-highlighter 提供网页版PDF文档的标注体验 建立在 PDF.js 之上。 支持文本和矩形突出显示。 强调 数据格式独立于视口,适合保存在 服务器。

Demo

https://agentcooper.github.io/react-pdf-highlighter/

Installation

npm install react-pdf-highlighter

Example

查看 demo/src/App.js React 组件 API 示例。

在处理文档时,请随时检查带有 Flow 注释的源 类型签名。

Prior art

react-pdfreact-pdfjs 只提供 React PDF.js 的包装器,没有内置注释功能。

pdfjs-annotate 不 开箱即用地提供文本高亮显示。

PDF.js 仅提供查看器:

PDF.js 主要用于阅读 PDF 文件,而不是编辑它们。 因此,我们还不支持添加任何类型的注释。 但是,我们确实支持呈现多种注释类型以供查看。

另请参阅:

  • https://github.com/mozilla/pdf.js
  • https://github.com/wojtekmaj/react-pdf
  • https://github.com/erikras/react-pdfjs
  • https://github.com/instructure/pdf-annotate.js/
  • https://blogs.dropbox.com/tech/2016/11/annotations-on-document-previews/

FAQ

Can I get a new PDF with the highlights embedded into the document?

不,但是 pdf-annotation-service 可能对你有帮助。

Wasn't this named react-pdf-annotator at some point?

是的,但是来自 https://www.pdfannotator.com/ 的人要求我重命名,因为 他们有 PDF Annotator 的商标

I'm trying the demo with my PDF and it is not loading!

请检查您网址上的 CORS 标头。 它是跨域请求所必需的。

Compatibility

适用于 Google Chrome、Safari 10+、Firefox 52+。 未在互联网上测试 探索者。

react-pdf-highlighter

react-pdf-highlighter provides annotation experience for PDF documents on web built on top of PDF.js. Text and rectangular highlights are supported. Highlight data format is independent of the viewport, making it suitable for saving on the server.

Demo

https://agentcooper.github.io/react-pdf-highlighter/

Installation

npm install react-pdf-highlighter

Example

See demo/src/App.js for React component API example.

While docs are in progress, feel free to check the source annotated with Flow type signatures.

Prior art

react-pdf and react-pdfjs only provide React wrappers for PDF.js and do not have built-in annotation functionality.

pdfjs-annotate does not provide text highlights out of the box.

PDF.js provides only viewer:

PDF.js is mainly written for reading PDF files, not editing them. Because of that we don't yet support adding any kind of annotations. We do however support rendering a number of annotation types for viewing.

See also:

  • https://github.com/mozilla/pdf.js
  • https://github.com/wojtekmaj/react-pdf
  • https://github.com/erikras/react-pdfjs
  • https://github.com/instructure/pdf-annotate.js/
  • https://blogs.dropbox.com/tech/2016/11/annotations-on-document-previews/

FAQ

Can I get a new PDF with the highlights embedded into the document?

No, but pdf-annotation-service might be helpful for you.

Wasn't this named react-pdf-annotator at some point?

Yes, but people from https://www.pdfannotator.com/ asked me to rename, since they have a trademark for PDF Annotator.

I'm trying the demo with my PDF and it is not loading!

Please check the CORS headers on your url. It is required for the cross-domain request.

Compatibility

Works in Google Chrome, Safari 10+, Firefox 52+. Not tested in Internet Explorer.

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文