# fh-front-react-pdf

> fh前端组提供的React 移动端PDF组件

Latest version **1.0.1** (published 2020-12-03) · ISC license · 0 weekly downloads

## Install

```sh
npm install fh-front-react-pdf
pnpm add fh-front-react-pdf
yarn add fh-front-react-pdf
bun add fh-front-react-pdf
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2020-12-03 |
| First published | 2020-12-03 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 324.4 KB |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| Author | mz-bill |
| Maintainers | feihe |
| Keywords | react, pdf, pdfjs, react-pdf |

## Links

- npm: https://www.npmjs.com/package/fh-front-react-pdf
- npm.io page: https://npm.io/package/fh-front-react-pdf

## Dependencies (3)

- [hammerjs](https://npm.io/package/hammerjs.md) ^2.0.8
- [react-pdf](https://npm.io/package/react-pdf.md) ^5.0.0
- [pdfjs-dist](https://npm.io/package/pdfjs-dist.md) ^2.4.456

## Alternatives

- [@cantoo/pdf-lib](https://npm.io/package/@cantoo/pdf-lib.md) — 297.9K weekly downloads
- [datatables.net-buttons](https://npm.io/package/datatables.net-buttons.md) — 200.1K weekly downloads
- [@ckeditor/ckeditor5-export-pdf](https://npm.io/package/@ckeditor/ckeditor5-export-pdf.md) — 167.0K weekly downloads
- [scanbot-web-sdk](https://npm.io/package/scanbot-web-sdk.md) — 15.0K weekly downloads
- [@syncfusion/ej2-angular-pdfviewer](https://npm.io/package/@syncfusion/ej2-angular-pdfviewer.md) — 8.8K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2020-12-03
- 1.0.0 — 2020-12-03

## README

<!--
 * @Author: your name
 * @Date: 2020-07-15 13:11:01
 * @LastEditTime: 2020-08-20 10:14:26
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /fh-react-pdf/README.md
-->

# React 移动端端 PDF 组件

fh 前端开发组提供

## 安装

yarn

> yarn add fh-front-react-pdf

npm

> npm i fh-front-react-pdf

## 使用

> 基本使用

```js
import React from "react"
import ReactDom from "react-dom"
import MobilePDFReader from "fh-front-react-pdf"

export default () => {
	return (
		<div>
			<MobilePDFReader url="你的PDF文件地址" />
		</div>
	)
}
```

> 配置信息使用

```js
import React from "react"
import ReactDom from "react-dom"
import MobilePDFReader from "fh-front-react-pdf"
const App = () => {
	return (
		<div>
			<MobilePDFReader
				url="你的PDF文件地址"
				defaultPage={1}
				onDocumentComplete={({ currentPage, totalPage }) => {
					console.log(`当前页数:${currentPage}`)
					console.log(`总页数:${totalPage}`)
				}}
				onPageChanged={currentPage => {
					console.log(`当前第几页:${currentPage}`)
				}}
			/>
		</div>
	)
}

ReactDom.render(<App />, document.getElementById("app"))
```

## API

| 参数               | 说明             | 类型                                 |
| ------------------ | ---------------- | ------------------------------------ |
| defaultPage        | 起始页数         | number                               |
| onDocumentComplete | PDF 加载完成回调 | Function( {currentPage, totalPage} ) |
| onPageChanged      | PDF 页数改变回调 | Function( currentPage )              |

---
_Source: https://npm.io/package/fh-front-react-pdf · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
