I've built a simple example that shows how to implement a Table. It's pretty straightfoward, check it out: https://github.com/Chagall/react-pdf-table-example

🌐
GitHub
github.com › enescang › react-pdf-table
GitHub - enescang/react-pdf-table: Simple table generator for @react-pdf/renderer
react-pdf-table is super simple table generator for @react-pdf/renderer
Starred by 13 users
Forked by 3 users
Languages   JavaScript
🌐
npm
npmjs.com › package › @ag-media › react-pdf-table
@ag-media/react-pdf-table - npm
Declarative table generator for for the @react-pdf/renderer.. Latest version: 2.0.3, last published: 7 months ago. Start using @ag-media/react-pdf-table in your project by running `npm i @ag-media/react-pdf-table`. There are 2 other projects in the npm registry using @ag-media/react-pdf-table.
      » npm install @ag-media/react-pdf-table
    
Published   May 15, 2025
Version   2.0.3
Author   AG Media
Discussions

Table in React pdf

Flex can be helpful, you should have a look on https://medium.com/@snowleo208/how-to-create-responsive-table-d1662cb62075

More on reddit.com
🌐 r/reactjs
2
3
March 24, 2020
reactjs - How can i create a table using the react-pdf library for generation pdf report? - Stack Overflow
As the react-pdf library offering some limited component and no html tag is allowed to render in reactpdfrenderer.So i am in a trouble to make table using this library? Can any one please help me h... More on stackoverflow.com
🌐 stackoverflow.com
Create table layout
Is your feature request related to a problem? Please describe. I'm the author of @ag-media/react-pdf-table, and after much time wrestling with the layout system, I've concluded that there&#... More on github.com
🌐 github.com
8
April 24, 2023
React Pdf and the nightmare of adjusting tables in it
I think there’s a break prop you can apply to primitives More on reddit.com
🌐 r/reactjs
7
1
August 3, 2025
🌐
React-pdf
react-pdf.org
React-pdf
React renderer for creating PDF files on the browser and server
🌐
React
react.dev › learn › rendering-lists
Rendering Lists – React
Is this page useful · You will often want to display multiple similar components from a collection of data. You can use the JavaScript array methods to manipulate an array of data. On this page, you’ll use filter() and map() with React to filter and transform your array of data into an array ...
🌐
PDF-LIB
pdf-lib.js.org
PDF-LIB · Create and modify PDF documents in any ... - JS.ORG
import { PDFDocument } from 'pdf-lib' // PDF Creation const pdfDoc = await PDFDocument.create() const page = pdfDoc.addPage() page.drawText('You can create PDFs!') const pdfBytes = await pdfDoc.save() // PDF Modification const pdfDoc = await PDFDocument.load(...) const pages = pdfDoc.getPages() pages[0].drawText('You can modify PDFs too!') const pdfBytes = await pdfDoc.save()
Find elsewhere
Top answer
1 of 4
19

You can use as @David-Kucsai told in comment @david.kucsai/react-pdf-table

or without using

Example

Data

const data = {
  id: "5df3180a09ea16dc4b95f910",
  items: [
    {
      sr: 1,
      desc: "desc1",
      xyz: 5,
    },
    {
      sr: 2,
      desc: "desc2",
      xyz: 6,
    },
  ],
};

app.js

import React, { Component, Fragment } from "react";
import { PDFViewer } from "@react-pdf/renderer";
import Table from "./components/reports/Table";
import data from "./data";

class App extends Component {
  render() {
    return (
      <Fragment>
        <PDFViewer width="1000" height="600">
          <Table data={data} />
        </PDFViewer>
      </Fragment>
    );
  }
}

export default App;

Table.js

import React from "react";
import { Page, Document, StyleSheet } from "@react-pdf/renderer";
import ItemsTable from "./ItemsTable";

const styles = StyleSheet.create({
  page: {
    fontSize: 11,
    flexDirection: "column",
  },
});

const Table = ({ data }) => (
  <Document>
    <Page size="A4" style={styles.page}>
      // ...
      <ItemsTable data={data} />
      // ...
    </Page>
  </Document>
);

export default Table;

ItemsTable.js

import React from "react";
import { View, StyleSheet } from "@react-pdf/renderer";
import TableRow from "./TableRow";

const styles = StyleSheet.create({
  tableContainer: {
    flexDirection: "row",
    flexWrap: "wrap",
  },
});

const ItemsTable = ({ data }) => (
  <View style={styles.tableContainer}>
    {/*<TableHeader />*/}
    <TableRow items={data.items} />
    {/*<TableFooter items={data.items} />*/}
  </View>
);

export default ItemsTable;

TableRow.js

import React, { Fragment } from "react";
import { Text, View, StyleSheet } from "@react-pdf/renderer";

const styles = StyleSheet.create({
  row: {
    flexDirection: "row",
    alignItems: "center",
  },
  description: {
    width: "60%",
  },
  xyz: {
    width: "40%",
  },
});

const TableRow = ({ items }) => {
  const rows = items.map((item) => (
    <View style={styles.row} key={item.sr.toString()}>
      <Text style={styles.description}>{item.desc}</Text>
      <Text style={styles.xyz}>{item.xyz}</Text>
    </View>
  ));
  return <Fragment>{rows}</Fragment>;
};

export default TableRow;

For more information check Generate Dynamic PDF Invoices Using React and React-PDF

2 of 4
9

Thanks goes to Yash for the detailed answer given. This is what I ended up creating after seeing your example.

The main trick to create a "table" is to use fixed width columns on each row.

Note: Make the parent container width: '100%' (table in this case) if you want to have your rows add up beyond 100% without overflowing/growing the parent. I would still recommend you try to have your total width add to 100% though, but the example below shows otherwise.

import { StyleSheet, Text, View } from '@react-pdf/renderer'
import PropTypes from 'prop-types'

const styles = StyleSheet.create({
  table: {
    width: '100%',
  },
  row: {
    display: 'flex',
    flexDirection: 'row',
    borderTop: '1px solid #EEE',
    paddingTop: 8,
    paddingBottom: 8,
  },
  header: {
    borderTop: 'none',
  },
  bold: {
    fontWeight: 'bold',
  },
  // So Declarative and unDRY 
  col1: {
    width: '27%',
  },
  col2: {
    width: '15%',
  },
  col3: {
    width: '15%',
  },
  col4: {
    width: '20%',
  },
  col5: {
    width: '27%',
  },
})

const ReportTable = ({ data, maximumDays }) => {
  return (
    <View style={styles.table}>
      <View style={[styles.row, styles.bold, styles.header]}>
        <Text style={styles.col1}>Name</Text>
        <Text style={styles.col2}>Start Date</Text>
        <Text style={styles.col3}>End Date</Text>
        <Text style={styles.col4}>Days</Text>
        <Text style={styles.col5}>Info</Text>
      </View>
      {data.map((row, i) => (
        <View key={i} style={styles.row} wrap={false}>
          <Text style={styles.col1}>
            <Text style={styles.bold}>{row.lastName}</Text>, {row.firstName}
          </Text>
          <Text style={styles.col2}>{row.startDate}</Text>
          <Text style={styles.col3}>{row.endDate}</Text>
          <Text style={styles.col4}>
            <Text style={styles.bold}>{row.days}</Text> of{' '}
            {maximumDays}
          </Text>
          <Text style={styles.col5}>{row.info}</Text>
        </View>
      ))}
    </View>
  )
}

ReportTable.propTypes = {
  data: PropTypes.array.isRequired,
  maximumDays: PropTypes.number.isRequired,
}

export default ReportTable

🌐
Material React Table
material-react-table.com › docs › examples › export pdf
PDF Export Example - Material React Table Docs
Material React Table does not have a data exporting feature built-in. However, you can easily integrate your own exporting features. In the example below, jspdf and jspdf-autotable are connected to some export buttons in the top toolbar to export table rows to a PDF file that can be downloaded.
🌐
jsDelivr
cdn.jsdelivr.net › @david.kucsai/[email protected]
@david.kucsai/react-pdf-table CDN by jsDelivr - A free, fast, and reliable Open Source CDN
Looking for a nice landing page for your package? https://www.jsdelivr.com/package/npm/@david.kucsai/react-pdf-table
🌐
React
react.dev › learn › thinking-in-react
Thinking in React – React
When you build a user interface with React, you will first break it apart into pieces called components. Then, you will describe the different visual states for each of your components. Finally, you will connect your components together so that the data flows through them. In this tutorial, we’ll guide you through the thought process of building a searchable product data table ...
🌐
CodeSandbox
codesandbox.io › examples › package › react-pdf-table
react-pdf-table examples - CodeSandbox
Use this online react-pdf-table playground to view and fork react-pdf-table example apps and templates on CodeSandbox.
🌐
GitHub
github.com › dmk99 › react-pdf-table
GitHub - dmk99/react-pdf-table: Storybook Available
This library is designed to be used with @react-pdf/renderer. The goal behind this library is to provide a declarative way of defining tables in a PDF.
Starred by 159 users
Forked by 64 users
Languages   TypeScript 91.3% | JavaScript 8.7%
🌐
CodeSandbox
codesandbox.io › s › react-pdf-tables-o1wp2
react-pdf-tables - CodeSandbox
April 22, 2020 - react-pdf-tables using @react-pdf/renderer, @testing-library/jest-dom, @testing-library/react, @testing-library/user-event, react, react-dom, react-scripts
Published   Apr 22, 2020
🌐
GitHub
github.com › diegomura › react-pdf › issues › 2343
Create table layout · Issue #2343 · diegomura/react-pdf
April 24, 2023 - Describe alternatives you've considered As of now, @ag-media/react-pdf-table is usable for a table that is contained to one page (we use it in production already), but if you want to wrap a table to multiple pages, it gets weird with no way ...
Published   Jun 20, 2023
🌐
Pdfmake
pdfmake.org
PDFMake
pdfmake, client/server side PDF printing in pure JavaScript