# pdf-annotate.js **Repository Path**: mfkvfhpdx/pdf-annotate.js ## Basic Information - **Project Name**: pdf-annotate.js - **Description**: 此项目对github上[pdf-annotate.js](https://github.com/Submitty/pdf-annotate.js)的一个修改版本,其中说明文档内容增加了汉化,scripts脚本增加了window。 - **Primary Language**: JavaScript - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 2 - **Created**: 2023-06-07 - **Last Updated**: 2023-10-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 此项目对github上[pdf-annotate.js](https://github.com/Submitty/pdf-annotate.js)的一个修改版本,修改内容见下: - 文档和api汉化。 - scripts脚本增加了window。 - weblegacy文件夹下为不需要打包的一个版本,直接拷贝就能用(通过npm run startlegacy启动服务可见效果),并且支持稍老版本的浏览器(原版本chrome80以下会报错)。 # @submitty/pdf-annotate.js [![Build Status](https://github.com/Submitty/pdf-annotate.js/workflows/Test/badge.svg?branch=master&event=push)](https://github.com/Submitty/pdf-annotate.js/actions?query=workflow%3ATest+event%3Apush+branch%3Amaster) [![npm version](https://img.shields.io/npm/v/@submitty/pdf-annotate.js)](https://npmjs.com/package/@submitty/pdf-annotate.js) [![codecov](https://codecov.io/gh/Submitty/pdf-annotate.js/branch/master/graph/badge.svg)](https://codecov.io/gh/Submitty/pdf-annotate.js) [PDF.js](https://github.com/mozilla/pdf.js)的注释层。 结合了已归档的[instructure/pdf-annotate.js](https://github.com/instructure/pdf-annotate.js/)和已删除的DynamicEnvironmentSystems/pdf-annotate.js的分支。正在积极开发以供[Submitty](https://github.com/Submitty/Submitty)使用。 要报告pdf-annotate.js的问题,请将其提交到[Submitty/Submitty](https://github.com/Submitty/Submitty)存储库中。 ## 目标 - 为[PDF.js](https://github.com/mozilla/pdf.js)提供低级别的注释层。 - 可选的高级UI用于管理注释。 - 不依赖后端,只需提供自己的`StoreAdapter`以获取/存储数据。 - 规定注释格式。 ## 安装 ```bash npm install @submitty/pdf-annotate.js ``` ## 示例 ```js import pdfjsLib from 'pdfjs-dist/build/pdf'; import PDFJSAnnotate from 'pdfjs-annotate'; const { UI } = PDFJSAnnotate; const VIEWER = document.getElementById('viewer'); const RENDER_OPTIONS = { documentId: 'MyPDF.pdf', pdfDocument: null, scale: 1, rotate: 0 }; pdfjsLib.GlobalWorkerOptions.workerSrc = 'pdf.worker.js'; PDFJSAnnotate.setStoreAdapter(new PDFJSAnnotate.LocalStoreAdapter()); pdfjsLib.getDocument(RENDER_OPTIONS.documentId).promise.then((pdf) => { RENDER_OPTIONS.pdfDocument = pdf; VIEWER.appendChild(UI.createPage(1)); UI.renderPage(1, RENDER_OPTIONS); }); ``` 请参阅[/web](https://github.com/Submitty/pdf-annotate.js/tree/web)以获取用于注释PDF的示例Web客户端。 ## 文档 [查看文档](/docs/README.md). ## 开发 ```bash # 克隆存储库 $ git clone https://github.com/Submitty/pdf-annotate.js.git $ cd pdf-annotate.js # 安装依赖项 $ npm install # 启动示例服务器 $ npm start $ open http://127.0.0.1:8080 # 运行测试 $ npm test # 对代码进行lint检查 $ npm run lint ```