bs-react-pdf

0.0.13 • Public • Published

bs-react-pdf npm version

react-pdf bindings for bucklescript

Installation

  1. $ npm i bs-react-pdf
  2. Add bs-react-pdf to bs-dependencies section of your bsconfig.json

Examples

Document

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) =>
    <Document>
      <Page size="A4" style=styles##page>
        <View style=styles##section>
          <Text key="hello"> (ReasonReact.stringToElement("Section #1")) </Text>
        </View>
        <View style=styles##section>
          <Text> (ReasonReact.stringToElement("Section #2")) </Text>
        </View>
      </Page>
    </Document>
};

Save in a file

ReactPdfNode.render(<MyDocument />, "example.pdf")
|> Js.Promise.then_(() => Js.Promise.resolve @@ Js.log("Pdf created"));

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.0.130latest

Version History

VersionDownloads (Last 7 Days)Published
0.0.130
0.0.120
0.0.110
0.0.100
0.0.90
0.0.80
0.0.70
0.0.60
0.0.50
0.0.40
0.0.30
0.0.20
0.0.10

Package Sidebar

Install

npm i bs-react-pdf

Weekly Downloads

0

Version

0.0.13

License

MIT

Last publish

Collaborators

  • meafmira