{"_id":"@antor-arif/html-pdf-converter","_rev":"5-eec90de091e00f378fcabe035e30a19d","name":"@antor-arif/html-pdf-converter","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"@antor-arif/html-pdf-converter","version":"1.0.0","keywords":["html","pdf","puppeteer","convert"],"author":{"name":"Arifur Rahman","email":"arifurrahman.ar10@yahoo.com"},"license":"MIT","_id":"@antor-arif/html-pdf-converter@1.0.0","maintainers":[{"name":"antor-arif","email":"arifurrahman.ar10@gmail.com"}],"homepage":"https://github.com/yourusername/your-repo-name#readme","bugs":{"url":"https://github.com/yourusername/your-repo-name/issues"},"dist":{"shasum":"2a7065002e83cdb3d1fb8546f47908b16c78b810","tarball":"https://registry.npmjs.org/@antor-arif/html-pdf-converter/-/html-pdf-converter-1.0.0.tgz","fileCount":8,"integrity":"sha512-zRpNnktNIgC5thlm0UXIyozjZZB/is17e8mPlHDQ9QRutvTrGh/XQOsFnY9m74Ht5HHjZwoqx8gOdua7mqtErw==","signatures":[{"sig":"MEYCIQDjsHQOsC5ubNyR1Lnaz2VHwI2PMS2V7upjo2qUGctRiAIhALWTx7jNMTZPXwOSwyLupg0wTd7XxM+pOR0qcdTROpDW","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":10568},"main":"index.js","engines":{"node":">=16.0.0"},"gitHead":"bc8161320b868f9fc917b0a9ea5d96e74cb49cb3","_npmUser":{"name":"antor-arif","email":"arifurrahman.ar10@gmail.com"},"repository":{"url":"git+https://github.com/antor-arif/html-pdf-converter.git","type":"git"},"_npmVersion":"8.19.2","description":"A Node.js package to convert HTML to PDF using Puppeteer.","directories":{},"_nodeVersion":"16.18.0","dependencies":{"puppeteer":"10.4.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/html-pdf-converter_1.0.0_1736924875306_0.007480030251577396","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@antor-arif/html-pdf-converter","version":"1.0.1","keywords":["html","pdf","puppeteer","convert"],"author":{"name":"Arifur Rahman","email":"arifurrahman.ar10@yahoo.com"},"license":"MIT","_id":"@antor-arif/html-pdf-converter@1.0.1","maintainers":[{"name":"antor-arif","email":"arifurrahman.ar10@gmail.com"}],"homepage":"https://github.com/antor-arif/html-pdf-converter#readme","bugs":{"url":"https://github.com/antor-arif/html-pdf-converter/issues"},"dist":{"shasum":"43e2f4873d2ac60c689549630f8caf77e9a852b7","tarball":"https://registry.npmjs.org/@antor-arif/html-pdf-converter/-/html-pdf-converter-1.0.1.tgz","fileCount":9,"integrity":"sha512-zLMoQHXpLrYTNKifvM10rP8CQCztBq+luWCfxtbXPmAVtRQxun1VKqL65jN4w6E02fMydiQdTtRR7TtgOhC91A==","signatures":[{"sig":"MEQCIHZX2u2+ICozjPBNQTcUyyGwCXtVOwvVX0Q0DUsf8bSqAiBeJFxWB9zQ1RP3eiSZ3Pz9ouDrp5rNKFRz3Q8fXpAVGA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":91412},"main":"index.js","engines":{"node":">=16.0.0"},"gitHead":"52e992023b2c2b8d2b7896eba74c0edf392030db","_npmUser":{"name":"antor-arif","email":"arifurrahman.ar10@gmail.com"},"repository":{"url":"git+https://github.com/antor-arif/html-pdf-converter.git","type":"git"},"_npmVersion":"8.19.2","description":"A Node.js package to convert HTML to PDF using Puppeteer.","directories":{},"_nodeVersion":"16.18.0","dependencies":{"puppeteer":"10.4.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/html-pdf-converter_1.0.1_1736928873474_0.546367231970335","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@antor-arif/html-pdf-converter","version":"1.0.2","keywords":["html","pdf","puppeteer","convert"],"author":{"name":"Arifur Rahman","email":"arifurrahman.ar10@yahoo.com"},"license":"MIT","_id":"@antor-arif/html-pdf-converter@1.0.2","maintainers":[{"name":"antor-arif","email":"arifurrahman.ar10@gmail.com"}],"homepage":"https://github.com/antor-arif/html-pdf-converter#readme","bugs":{"url":"https://github.com/antor-arif/html-pdf-converter/issues"},"dist":{"shasum":"7d55a5e135f114326eaa00e72651596b4e9e1fd8","tarball":"https://registry.npmjs.org/@antor-arif/html-pdf-converter/-/html-pdf-converter-1.0.2.tgz","fileCount":8,"integrity":"sha512-WVq07oTlkkqDXbwBvmZzvLcTlsk05NWFAgQain32ggTBp4wb/ZopVtxOo7uZ+YtutzPbW8erb9F7DZvZypkbVQ==","signatures":[{"sig":"MEUCIQCKvAahfut0tH2sg4vhe3h+ReG7T884TlZeLBJDoCHyLgIgecbOb/yd1CFUpjqccS4F6BKu+Zs+MLkm9LAW7VTcGDo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":10856},"main":"index.js","engines":{"node":">=16.0.0"},"gitHead":"b3560303e6a877a19a70b7f82d9e7835a776aae6","_npmUser":{"name":"antor-arif","email":"arifurrahman.ar10@gmail.com"},"repository":{"url":"git+https://github.com/antor-arif/html-pdf-converter.git","type":"git"},"_npmVersion":"8.19.2","description":"A Node.js package to convert HTML to PDF using Puppeteer.","directories":{},"_nodeVersion":"16.18.0","dependencies":{"puppeteer":"10.4.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/html-pdf-converter_1.0.2_1736932467598_0.7163863450155068","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@antor-arif/html-pdf-converter","version":"1.0.3","keywords":["html","pdf","puppeteer","convert"],"author":{"name":"Arifur Rahman","email":"arifurrahman.ar10@yahoo.com"},"license":"MIT","_id":"@antor-arif/html-pdf-converter@1.0.3","maintainers":[{"name":"antor-arif","email":"arifurrahman.ar10@gmail.com"}],"homepage":"https://github.com/antor-arif/html-pdf-converter#readme","bugs":{"url":"https://github.com/antor-arif/html-pdf-converter/issues"},"dist":{"shasum":"7addfaaaeb5be2802fb8109854d47842148b458b","tarball":"https://registry.npmjs.org/@antor-arif/html-pdf-converter/-/html-pdf-converter-1.0.3.tgz","fileCount":8,"integrity":"sha512-OCjNqwylfPFzvIyaNC3HS1s30EW/gY8zUhwuUQe7fMCHm9yppIFIFIyP9NiF+/goW1e96sZj5tjAyByDCP+NTA==","signatures":[{"sig":"MEUCIQDZGwBBgOm8NamLGHady9NV67qgBM80eS/GlnMmNEQuhAIge57pvn0RaftMkwAG4gmobkZYiG4BbJDUYb8ac6oBAO8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":14070},"main":"index.js","engines":{"node":">=16.0.0"},"gitHead":"6445f26d83fdf8ef5da4eafeeb20f86d7cdeaae4","_npmUser":{"name":"antor-arif","email":"arifurrahman.ar10@gmail.com"},"repository":{"url":"git+https://github.com/antor-arif/html-pdf-converter.git","type":"git"},"_npmVersion":"8.19.2","description":"A Node.js package to convert HTML to PDF using Puppeteer.","directories":{},"_nodeVersion":"16.18.0","dependencies":{"puppeteer":"10.4.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/html-pdf-converter_1.0.3_1736933491981_0.12377853906477054","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@antor-arif/html-pdf-converter","version":"1.0.4","keywords":["html","pdf","puppeteer","convert"],"author":{"name":"Arifur Rahman","email":"arifurrahman.ar10@yahoo.com"},"license":"MIT","_id":"@antor-arif/html-pdf-converter@1.0.4","maintainers":[{"name":"antor-arif","email":"arifurrahman.ar10@gmail.com"}],"homepage":"https://github.com/antor-arif/html-pdf-converter#readme","bugs":{"url":"https://github.com/antor-arif/html-pdf-converter/issues"},"dist":{"shasum":"9bb3074cb8ad1fe8a0e638a40c305a4e9b64d5d8","tarball":"https://registry.npmjs.org/@antor-arif/html-pdf-converter/-/html-pdf-converter-1.0.4.tgz","fileCount":8,"integrity":"sha512-C5ayWBUuYZxfZqX5y0NEbxErLxqApE1MqwgxLhLM1Ehrfa/LfXy34XlsLkOfP3Wp6Fx3ndP844EALRCyAWu4WQ==","signatures":[{"sig":"MEUCID1WaoHi1Vcr+OdVrp18H4GmFFp6Wp5arZV/4fdA86cbAiEA0PFk/8w3hh9zrAm1hUowIw3Xz26cSr8v79uZUGHa+/U=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":14075},"main":"index.js","engines":{"node":">=16.0.0"},"gitHead":"dc5ee08c3da2c0dda221763c6d17538ca2fdec4a","_npmUser":{"name":"antor-arif","email":"arifurrahman.ar10@gmail.com"},"repository":{"url":"git+https://github.com/antor-arif/html-pdf-converter.git","type":"git"},"_npmVersion":"8.19.2","description":"A Node.js package to convert HTML to PDF using Puppeteer.","directories":{},"_nodeVersion":"16.18.0","dependencies":{"puppeteer":"10.4.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/html-pdf-converter_1.0.4_1736935677047_0.9328227408379406","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@antor-arif/html-pdf-converter","version":"1.1.0","description":"A Node.js package to convert HTML to PDF using Puppeteer.","main":"index.js","author":{"name":"Arifur Rahman","email":"arifurrahman.ar10@yahoo.com"},"repository":{"type":"git","url":"git+https://github.com/antor-arif/html-pdf-converter.git"},"keywords":["html","pdf","puppeteer","convert"],"bugs":{"url":"https://github.com/antor-arif/html-pdf-converter/issues"},"homepage":"https://github.com/antor-arif/html-pdf-converter#readme","license":"MIT","dependencies":{"puppeteer":"10.4.0"},"engines":{"node":">=16.0.0"},"_id":"@antor-arif/html-pdf-converter@1.1.0","gitHead":"1e5db3bca1f1ed4909f9b8a4e441475b18acec93","_nodeVersion":"20.14.0","_npmVersion":"10.7.0","dist":{"integrity":"sha512-XUdLP82LPtZggIkdMS/LzMoLhh+W5nMdxzGgptx61M6ZbA+DTZXhtZ8j+fpecopUiti6yJFD2OhQBbwlgWf+dA==","shasum":"fb56df0a481fcf8f95ecdaf59307b0cb49f5699c","tarball":"https://registry.npmjs.org/@antor-arif/html-pdf-converter/-/html-pdf-converter-1.1.0.tgz","fileCount":8,"unpackedSize":13635,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDVlRHrAQbpfDL8b7LuYp4YM3en23nfNc/x6LxCDUebVAiEA8CuMND3c41Myu1aMbz5AOOK1bvnvH+2gXa7R5Zo6HiA="}]},"_npmUser":{"name":"antor-arif","email":"arifurrahman.ar10@gmail.com"},"directories":{},"maintainers":[{"name":"antor-arif","email":"arifurrahman.ar10@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/html-pdf-converter_1.1.0_1736949889686_0.06921163191671975"},"_hasShrinkwrap":false}},"time":{"created":"2025-01-15T07:07:55.234Z","modified":"2025-01-15T14:04:50.059Z","1.0.0":"2025-01-15T07:07:55.490Z","1.0.1":"2025-01-15T08:14:33.685Z","1.0.2":"2025-01-15T09:14:27.765Z","1.0.3":"2025-01-15T09:31:32.170Z","1.0.4":"2025-01-15T10:07:57.237Z","1.1.0":"2025-01-15T14:04:49.890Z"},"bugs":{"url":"https://github.com/antor-arif/html-pdf-converter/issues"},"author":{"name":"Arifur Rahman","email":"arifurrahman.ar10@yahoo.com"},"license":"MIT","homepage":"https://github.com/antor-arif/html-pdf-converter#readme","keywords":["html","pdf","puppeteer","convert"],"repository":{"type":"git","url":"git+https://github.com/antor-arif/html-pdf-converter.git"},"description":"A Node.js package to convert HTML to PDF using Puppeteer.","maintainers":[{"name":"antor-arif","email":"arifurrahman.ar10@gmail.com"}],"readme":"# HTML to PDF Converter\n\nA Node.js package to convert HTML to PDF using Puppeteer.\n\n## Requirements\n- Node.js >= 16\n- Puppeteer >= v10.4.0\n\n# html-pdf-converter\n\n`html-pdf-converter` is a Node.js package that converts HTML content into PDF files using Puppeteer. This lightweight and easy-to-use package ensures high-quality PDF generation from any HTML input.\n\n---\n\n## Features\n- Converts HTML strings into PDF files.\n- Supports Puppeteer for reliable and stable performance.\n- Compatible with Node.js 16 or higher.\n- Fully customizable PDF options (e.g., page size, margins, background printing).\n- Advanced configuration for Puppeteer instance (e.g., custom headers, authentication, or external browser endpoint).\n\n---\n\n## Requirements\n- **Node.js**: v16 or higher.\n- **Puppeteer**: v10.4.0 or higher (included in dependencies).\n\n---\n\n## Installation\nInstall the package using Yarn:\n```bash\nyarn add @antor-arif/html-pdf-converter\n```\n\n---\n\n## Usage\nBelow is a simple example of how to use the package:\n\n### Basic Example\n```javascript\nconst HTMLToPDF = require(\"@antor-arif/html-pdf-converter\");\n\n(async () => {\n    const htmlToPdf = new HTMLToPDF(); // Instantiate the class\n\n    const html = `\n    <html>\n      <head>\n        <title>PDF Test</title>\n      </head>\n      <body>\n        <h1>Hello, World!</h1>\n        <p>This is a PDF generated using html-pdf-converter.</p>\n      </body>\n    </html>\n  `;\n\n    const outputPath = \"output.pdf\";\n\n    try {\n        const pdfPath = await htmlToPdf.generatePDF(html, outputPath);\n        console.log(`PDF successfully created at: ${pdfPath}`);\n    } catch (error) {\n        console.error(\"Error generating PDF:\", error);\n    } finally {\n        await htmlToPdf.closeBrowser();\n    }\n})();\n```\n\n---\n\n## API Reference\n\n### `create(html, outputPath, options)`\n\nConverts an HTML string into a PDF file.\n\n#### Parameters:\n- **`html`** (string): The HTML content to convert. This must be a valid, non-empty string.\n- **`outputPath`** (string): The file path where the PDF will be saved.\n- **`options`** (object, optional): Puppeteer PDF configuration options (e.g., `format`, `margin`, `printBackground`).\n\n#### Returns:\n- A `Promise<string>` that resolves to the path of the generated PDF file.\n\n#### Example with Custom Options:\n```javascript\nconst HTMLToPDF = require(\"@antor-arif/html-pdf-converter\");\n\n(async () => {\n    const htmlToPdf = new HTMLToPDF();\n\n    const html = \"<h1>Custom PDF</h1><p>This PDF has custom settings.</p>\";\n    const outputPath = \"custom-output.pdf\";\n\n    const options = {\n        format: \"Letter\",\n        margin: {\n            top: \"1in\",\n            bottom: \"1in\",\n            left: \"1in\",\n            right: \"1in\",\n        },\n        printBackground: true,\n    };\n\n    try {\n        const pdfPath = await htmlToPdf.generatePDF(html, outputPath, options);\n        console.log(`Custom PDF created at: ${pdfPath}`);\n    } catch (error) {\n        console.error(\"Error generating custom PDF:\", error);\n    } finally {\n        await htmlToPdf.closeBrowser();\n    }\n})();\n```\n\n---\n\n## Advanced Features\n\n### External Browser Endpoint\nYou can connect to an existing Puppeteer browser instance using the `browserWSEndpoint` option:\n```javascript\nconst HTMLToPDF = require(\"@antor-arif/html-pdf-converter\");\n\n(async () => {\n    const htmlToPdf = new HTMLToPDF();\n\n    await htmlToPdf.setOptions({\n        browserWSEndpoint: \"ws://localhost:3000\",\n    });\n\n    const html = \"<h1>PDF from External Browser</h1>\";\n    const outputPath = \"external-browser-output.pdf\";\n\n    try {\n        const pdfPath = await htmlToPdf.generatePDF(html, outputPath);\n        console.log(`PDF created using external browser at: ${pdfPath}`);\n    } catch (error) {\n        console.error(\"Error generating PDF with external browser:\", error);\n    }\n})();\n```\n\n---\n\n## License\nThis package is licensed under the MIT License. See the LICENSE file for more details.\n\n---\n\n## Author\nArifur Rahman\n\n---\n\n## Contribution\nContributions are welcome! If you find any issues or have feature requests, feel free to open an issue or submit a pull request on the GitHub repository.\n\n---\n\n## Troubleshooting\nIf you encounter issues:\n1. Ensure that Puppeteer is correctly installed.\n2. Check for Node.js version compatibility (Node.js 16 or higher).\n3. Verify that your HTML content is valid.\n4. Ensure Puppeteer dependencies (like Chromium) are accessible in production environments (e.g., Docker or CI/CD pipelines).\n\nFor additional help, consult the Puppeteer [Troubleshooting Guide](https://pptr.dev/troubleshooting).\n\n---\n\n## Feedback\nWe'd love to hear your thoughts! Submit feedback or questions by opening an issue on the repository.\n","readmeFilename":"README.md"}