1.0.5 • Published 3 years ago
node-ts-pdf
Licence
ISC
Version
1.0.5
Deps
60
Size
25 kB
Vulns
0
Weekly
0
node-ts-pdf
A simple html template to base64 converter package, beautifully designed & well maintained.
Will use in node.js OR node with typescript backend.
Installation
Install node-ts-pdf with npm
npm install node-ts-pdf
Usage/Examples
import { html_to_base64 } from 'node-ts-pdf/lib/add';
async function App() {
const base64_result = await html_to_base64(`YOUR_HTML_TEMPLATE`, false);
console.log('get base64 result :=', base64_result);
return base64_result;
}
Implementation using optional parameters
async function App() {
const base64_result = await html_to_base64(`YOUR_HTML_TEMPLATE`, false, 595, 842, 2);
console.log('get base64 result :=', base64_result);
return base64_result;
}
Parameters
| Parameter | Type | Description |
|---|---|---|
printBackground |
boolean |
Required. Pass this parameter true/false for printing the background |
vw_width |
number |
Optional. Adjust the A4 paper width in pixels. Default: 595 |
vw_height |
number |
Optional. Adjust the A4 paper height in pixels Default: 842 |
deviceScaleFactor |
number |
Optional. Adjust the scale factor if needed. Default: 2 |