Convert component to pdf now easy in react
Contact Developer on godofsoftwaret@gmail.com-/-7200066633.
Install npm package
npm install gost-component-to-pdf
import {gostComponentToPDF} from 'gost-component-to-pdf'
import component from './componentFile.js'
//public/resumes/document.pdf
var filePath = '/path/to/save/document.pdf'
var apiFilePath = '' || '/api/savePDF' //default value is empty to download PDF in client browser. To save it in server folder please do the steps below
// To enable file saving functionality in your server folder, please follow these steps:
// 1. Navigate to the `node_modules/gost-component-to-pdf` directory in your project.
// 2. Locate the `savePDF.js` file.
// 3. Copy the `savePDF.js` file.
// 4. Paste the `savePDF.js` file into your API folder, typically located at `your_project_folder/pages/api`.
// 5. Once the file is copied, you should be able to save files to your server folder successfully.
// If you encounter any issues or have questions, feel free to ask for further assistance.
//single page
gostComponentToPDF(<component/>, filePath, apiFilePath)
// (component, pathToSave/WithFileName.Extension, apiFilePath)
// output
// Success: { success: true, status: 200, Message: 'Uploaded Successfully' }
// Failed: { success: false, status: 500, Message: Error Message }
//multiple page
gostComponentToPDF([<component1 key="key-1"/>, <component2 key="key-2"/>], filePath, apiFilePath)
// ([component1, component2], pathToSave/WithFileName.Extension, apiFilePath)
// output
// Success: { success: true, status: 200, Message: 'Uploaded Successfully' }
// Failed: { success: false, status: 500, Message: Error Message }
Developer Contact gost at godofsoftwaret@gmail.com-/-7200066633
To enable file saving functionality in your server folder, please follow these steps:
- Navigate to the
node_modules/gost-component-to-pdf
directory in your project. - Locate the
savePDF.js
file. - Copy the
savePDF.js
file. - Paste the
savePDF.js
file into your API folder, typically located atyour_project_folder/pages/api
. - Once the file is copied, you should be able to save files to your server folder successfully.
If you encounter any issues or have questions, feel free to ask for further assistance.