Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ornament-health/react-native-pdf-editor
React Native PDF Editor
https://github.com/ornament-health/react-native-pdf-editor
android frontend ios library mobile objective-c react react-native reactjs swift
Last synced: about 1 month ago
JSON representation
React Native PDF Editor
- Host: GitHub
- URL: https://github.com/ornament-health/react-native-pdf-editor
- Owner: Ornament-Health
- License: mit
- Created: 2023-07-20T15:22:50.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-07-25T10:36:27.000Z (4 months ago)
- Last Synced: 2024-10-10T10:21:07.854Z (about 1 month ago)
- Topics: android, frontend, ios, library, mobile, objective-c, react, react-native, reactjs, swift
- Language: Kotlin
- Homepage: https://www.npmjs.com/package/@ornament-health/react-native-pdf-editor
- Size: 2.68 MB
- Stars: 4
- Watchers: 4
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# react-native-pdf-editor
React Native PDF editor (iOS)
## Installation
```sh
npm install @ornament-health/react-native-pdf-editor
cd ios
pod install
```## Usage
In order to start using RNPDFEditorView, you should create configuration for it with local link to document and some styling parameters. You can handle visibility of native toolbar, backgrounf color, line color and width from React Native side.```typescript
import { RNPDFEditorView } from "@ornament-health/react-native-pdf-editor";// ...
const options = {
fileName: source,
isToolBarHidden: false,
viewBackgroundColor: '#40a35f',
lineColor: '#4287f5',
lineWidth: 40,
startWithEdit: true,
};
```
Saving option can return 'null' if there was errors at native side, otherwise it will return string contains local path to saved document. Note, that after every saving action document stores at apps Document Directory, so removing unnecessary local copies should be provided at React Native side.
```typescript
const handleSavePDF = (e: string | null) => {
if (e === null) {
console.log('got null value for url:', e);
} else {
console.log('got url:', e);
}
};
```Native methods Scroll/Draw/Undo/Save can be accessed from React Native side by using ref.
```typescript
const pdfRef = useRef(null);const onPressScroll = () => {
pdfRef.current?.scrollAction();
};```
## Contributing
See the [contributing guide](.github/CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
## License
MIT