Skip to content

mainak9163/PdfGenerator

Repository files navigation

Screenshot Capture - 2024-03-28 - 11-30-17

PDFternity

A full stack (NextJS with Typescript) app where you will get free PDF templates make as many changes as you want and generate the PDF to download it!


🎬 Video Demo(In case you dont wish to download ,you can view my linkedin post to watch the demo there)

https://res.cloudinary.com/dxprcmmcz/video/upload/v1712950045/2024-04-12_12-03-27_hfsulv.mkv

😎 LinkedIn Post on how I made my own resume using my app:

https://www.linkedin.com/posts/mainak-mukherjee1234_launching-pdfternity-v2-edit-there-activity-7219380702742536193-voZ_?utm_source=share&utm_medium=member_desktop

📦Project Screenshots:


Step 1: Choose a template and find what changes need to be made

Screenshot Capture - 2024-03-28 - 15-27-57

Step 2:Make the change like here I have changed the name

Screenshot Capture - 2024-03-28 - 15-30-10

Step 3:Click on generate button and view the preview and if its all good , download it!

Screenshot Capture - 2024-03-28 - 15-34-19

💻 Built with

Technologies used in the project:

  • NextJS
  • TailwindCSS
  • OneDoc API
  • Google Analytics

🧐 Features

Here're some of the project's best features:

  • Built with latest technologies like NextJS , TailwindCSS , Typescript.
  • Cool Landing Page made using Aceternity UI.
  • Currently features three awesome PDF templates:Detailed CV, Airbnb, Receipt and Invoice
  • Make as many changes as you want !
  • Responsive app view the proper PDF layout even on mobile
  • Use text editors to reproduce italics or bold text for highlighting key data
  • Can generate both light and dark mode view of the pdf
  • Finally generate the PDF and download it!
  • Built on top of Onedoc API a super cool tool to convert code to PDF.
  • Uses Google Analytics for website tracking.

📚 Working of the app

* A template page will have two parts: one is the actual template and the other is the form which will help in making changes to the template. We will have an intial state variable which will store the data for the pdf. We will additionally make a functional component for the template and while calling it in the page pass the data as props so that the data used for the template remains dynamic . We will also make a form in the page using which we will make changes to the state and that will cause re-render and hence the props for the component too will change and hence the template will keep getting updated.

* Now once the user is finished , Generate button will be clicked which will do two things:i) store the data and the template currently being used in the local storage of the browser ii) redirect the user to viewPDF page.

* As soon as the viewPDF page gets loaded , the useEffect hook runs (being made to run only intially when the component loads) , a POST call is made to the backend server's api (at "/api/v1/getPDF") where the template and data is passed as requestbody (server won't be able to access localstorage so we will need to pass it from the client side) .

* In the controller of the api , we call the OneDocPdf component and pass the data and template info to it.

* In the OneDocPdf Component we call that specific component which matches teh template and returns its JSX prepared using the data which was passed to it as props. The JSX gets wrapped with Tailwind from @onedoc/react-print so that the tailwind classes remain active in their server. The resulting JSX is compiled into html and css using compile function and it is sent to onedoc server for conversion into pdf data (this thing happens internally and implemented using onedoc.render. That data is sent back to the client .

* After the pdf data is received , the corresponding PDF gets displayed removing the loading screen.


🛠️ Installation Steps:


1. Clone the project

git clone https://github.com/career-tokens/pdfGenerator

2. Go to the project directory

cd pdfGenerator

3. Install dependencies

npm install

4.Create .env file according to .env.example and make sure to put corresponding values to the environment variables. Collect OneDoc API from their website

5. Run the server:

npm run dev

About

Live Link for the app:

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages