|
1 | | -# react-native-pdf-from-image |
| 1 | +<h1 align="center"> |
| 2 | + <img width="200" height="200" src="./IMG/logo.png"/><br/> |
| 3 | + React Native Pdf From Image Library |
| 4 | +</h1> |
2 | 5 |
|
3 | | -Des |
| 6 | +Generate PDF documents from an array images. |
4 | 7 |
|
5 | | -## Installation |
| 8 | +## 🌟 Features |
| 9 | + |
| 10 | +- **Image to PDF Conversion**: Effortlessly convert images into PDF documents. |
| 11 | +- **Customizable Paper Sizes**: Choose from standard paper sizes or define custom dimensions for your PDFs. |
| 12 | + |
| 13 | +## Old Architecture Support |
| 14 | + |
| 15 | +> [!WARNING] |
| 16 | +> react-native-pdf-from-image is a pure C++ TurboModule, and **requires the new architecture to be enabled**. |
| 17 | +> |
| 18 | +> - Work is ongoing to support the old architecture. |
| 19 | +
|
| 20 | +## 🚀 Installation |
6 | 21 |
|
7 | 22 | ```sh |
8 | 23 | npm install react-native-pdf-from-image |
9 | 24 | ``` |
10 | 25 |
|
11 | | -## Usage |
| 26 | +or |
| 27 | + |
| 28 | +```sh |
| 29 | +yarn add react-native-pdf-from-image |
| 30 | +``` |
| 31 | + |
| 32 | +```sh |
| 33 | +cd ios && pod install |
| 34 | +``` |
12 | 35 |
|
| 36 | +## 📖 Usage |
| 37 | + |
| 38 | +Here's a basic example of how to use the library: |
13 | 39 |
|
14 | 40 | ```js |
15 | | -import { multiply } from 'react-native-pdf-from-image'; |
| 41 | +import { createPdf } from 'react-native-pdf-from-image'; |
16 | 42 |
|
17 | | -// ... |
| 43 | +const images = ['path/to/image1.jpg']; |
18 | 44 |
|
19 | | -const result = multiply(3, 7); |
| 45 | +const { filePath } = createPdf({ |
| 46 | + imagePaths: images, |
| 47 | + name: 'myPdf', |
| 48 | + paperSize: 'A4', |
| 49 | + customPaperSize: { |
| 50 | + height: 300, |
| 51 | + width: 300, |
| 52 | + }, |
| 53 | +}); |
20 | 54 | ``` |
21 | 55 |
|
| 56 | +## 📦 Props |
| 57 | + |
| 58 | +### createPdf(params) |
| 59 | + |
| 60 | +- params : An object containing the following properties: |
| 61 | + - imagePaths (Array of strings): An array of file paths to the images you want to include in the PDF. |
| 62 | + - name (string): The name of the PDF file to be created. |
| 63 | + - paperSize (string, optional): The size of the paper for the PDF. Common sizes like 'A4' are supported. |
| 64 | + - customPaperSize (object, optional): An object specifying custom dimensions for the paper size. It should have height and width properties. |
| 65 | + |
| 66 | +### Returns |
| 67 | + |
| 68 | +- An object containing: |
| 69 | + - filePath (string): The file path to the generated PDF document. |
22 | 70 |
|
23 | 71 | ## Contributing |
24 | 72 |
|
25 | 73 | See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow. |
26 | 74 |
|
27 | 75 | ## License |
28 | 76 |
|
29 | | -MIT |
| 77 | +This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more information. |
30 | 78 |
|
31 | 79 | --- |
32 | | - |
33 | | -Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob) |
|
0 commit comments