Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/meafmira/bs-react-pdf
react-pdf bindings for bucklescript
https://github.com/meafmira/bs-react-pdf
bs-react-pdf bucklescript ocaml react react-pdf reason reasonml
Last synced: about 1 month ago
JSON representation
react-pdf bindings for bucklescript
- Host: GitHub
- URL: https://github.com/meafmira/bs-react-pdf
- Owner: meafmira
- License: mit
- Created: 2017-09-14T15:00:24.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-11-08T15:46:48.000Z (about 7 years ago)
- Last Synced: 2024-09-29T06:41:09.149Z (about 2 months ago)
- Topics: bs-react-pdf, bucklescript, ocaml, react, react-pdf, reason, reasonml
- Language: OCaml
- Size: 28.3 KB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bs-react-pdf [![npm version](https://img.shields.io/npm/v/bs-react-pdf.svg?style=flat-square)](https://www.npmjs.com/package/bs-react-pdf)
[react-pdf](https://github.com/diegomura/react-pdf) bindings for [bucklescript](https://bucklescript.github.io/bucklescript/)
## Installation
1. `$ npm i bs-react-pdf`
2. Add `bs-react-pdf` to `bs-dependencies` section of your `bsconfig.json`## [Examples](https://github.com/meafmira/bs-react-pdf/tree/master/examples)
### Document```reason
open ReactPdf.Core;let styles =
StyleSheet.create({
"page": {"flexDirection": "row", "backgroundColor": "#fff"},
"section": {"margin": 10, "padding": 10, "flexGrow": 1}
});let component = ReasonReact.reducerComponent("MyDocument");
let make = (_children) => {
...component,
reducer: ((), _state: unit) => ReasonReact.NoUpdate,
render: (_self) =>
(ReasonReact.stringToElement("Section #1"))
(ReasonReact.stringToElement("Section #2"))
};
```### Save in a file
```reason
ReactPdfNode.render(, "example.pdf")
|> Js.Promise.then_(() => Js.Promise.resolve @@ Js.log("Pdf created"));
```