Search code examples
reactjspdfmeteorsemantic-uireact-pdf

How can i add user features(name, department etc.) into my const variable in react?


I want to make a pdf from my user information page . I use react-pdf but i do not find information about using props from my document variable in react-pdf webpage. Is that possible to use it or how can i do without use any prop?

const MyDoc = () => (
<Document>
  <Page size="A4" style={styles.page}>
    <View style={styles.section}>
    <Header as="h5" dividing color="teal" content="User Info" />
       Please contact with your manager
        <Table id="pdf">
          <Table.Body>
            <Table.Row>
              <Table.Cell><Header as='h4'>Name</Header></Table.Cell>
              <Table.Cell>{this.props.user.profile.name == null || this.props.user.profile.surname == null ? "-" : this.props.user.profile.name + " " + this.props.user.profile.surname}</Table.Cell>
            </Table.Row>   .....

Solution

  • You can use user information without passing as props if is collected it from the same page, Or you can assign user information to a variable from the page where you collected from and try to import to MyDoc().