0

I am trying to create a button which allows users to download their project timeline.

const filteredItems = events?.events.forEach((event) => {
        const items = 'Event id:' + event.id + " \nCreated date: " + event.created_at + "\nEvent: " + event.body + '\n Event type: ' + event.type
        console.log(items);
        return items;
    });

I have looped through the events in project timeline and stored the useful data in "items". Now I want to create a pdf from the items variable and allow users to download it. I am having a hard time figuring out how to work with creating a pdf in react. Would greatly appreciate your help. Thanks!

I tried pdf renderer but couldn't get the contents inside the pdf file.

  • Please try with this [jspdf](https://www.npmjs.com/package/jspdf). And here is an [example](https://udithajanadara.medium.com/export-react-component-as-a-pdf-5afba8ba02ee) using this package. – Jason Ming Jul 21 '23 at 18:06

0 Answers0