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: 3 months 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 (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-11-08T15:46:48.000Z (over 8 years ago)
- Last Synced: 2025-03-24T07:40:49.088Z (about 1 year ago)
- Topics: bs-react-pdf, bucklescript, ocaml, react, react-pdf, reason, reasonml
- Language: OCaml
- Size: 28.3 KB
- Stars: 3
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bs-react-pdf [](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"));
```