Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasjunior authored Aug 28, 2024
1 parent d3ba0cf commit 9dcda32
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ It uses [PdfRenderer](https://developer.android.com/reference/android/graphics/p

## Why another PDF renderer?

The main reason why I create this library is to avoid using third party native dependencies, like `com.github.TalbotGooday:AndroidPdfViewer`, `com.github.mhiew:android-pdf-viewer`, `react-native-blob-util` or even `react-native-webview`.
The main reason why I create this library is to avoid using third-party native dependencies, like `com.github.TalbotGooday:AndroidPdfViewer`, `com.github.mhiew:android-pdf-viewer`, `react-native-blob-util` or even `react-native-webview`.

But why?

Expand Down Expand Up @@ -65,17 +65,17 @@ const App = () => {
export default App;
```

The `source` prop must point to a file stored inside device memory.
The `source` prop must point to a file stored inside the device memory.

If the file is online, you can use some third part library like `expo-file-system`, `rn-fetch-blob` or `react-native-blob-util` to download and save locally.
If the file is online, you can use some third-party library like `expo-file-system`, `rn-fetch-blob`, or `react-native-blob-util` to download and save it locally.

For more details, see the [Sample Project](https://github.com/douglasjunior/react-native-pdf-renderer/blob/main/Sample/App.tsx).

## PdfRendererView props

|Name|Type|Default|Description|
|-|-|-|-|
|source|`string`||Path to a file stored on device.|
|source|`string`||Path to a file stored on the device.|
|distanceBetweenPages|`number`|`16`|Distance in `DPI` between pages.|
|maxZoom|`number`|`5`|Max zoom scale.|
|singlePage|`boolean`|`false`|(Experimental) Renders only the first page without scroll. (useful for display thumbnail)|
Expand All @@ -84,13 +84,19 @@ For more details, see the [Sample Project](https://github.com/douglasjunior/reac

## Limitations

### Page interactions

Because Android renders the PDF page as a full image, it does not support text selection, accessibility, or handling links.

If any of these features are important for your product, we recommend adding a button to open the PDF in an external PDF viewer.

### Size measuring

The `PdfRendererView` is `flex: 1` by default, so you need to make sure that your parents `View` are `flex: 1` or have a fixed `width/height`.
The `PdfRendererView` is `flex: 1` by default, so you need to make sure that your parents `View`s are `flex: 1` or have a fixed `width/height`.

### Border radius

The `borderRadius` style is ignored by React Native custom view in Android and crash on iOS. (read more [#1](https://github.com/douglasjunior/react-native-pdf-renderer/issues/1#issuecomment-1483395465))
The `borderRadius` style is ignored by React Native custom view in Android and crashes on iOS. (read more [#1](https://github.com/douglasjunior/react-native-pdf-renderer/issues/1#issuecomment-1483395465))

If you need `borderRadius`, the best option is to wrap the `PdfRendererView` in another `View`.

Expand All @@ -110,7 +116,7 @@ jest.mock('react-native-pdf-renderer', () => require('react-native-pdf-renderer/

## Contribute

New features, bug fixes and improvements are welcome! For questions and suggestions use the [issues](https://github.com/douglasjunior/react-native-pdf-renderer/issues).
New features, bug fixes, and improvements are welcome! For questions and suggestions use the [issues](https://github.com/douglasjunior/react-native-pdf-renderer/issues).

<a href="https://www.patreon.com/douglasjunior"><img src="http://i.imgur.com/xEO164Z.png" alt="Become a Patron!" width="200" /></a>
[![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://paypal.me/douglasnassif)
Expand Down

0 comments on commit 9dcda32

Please sign in to comment.