Convert multiple html strings to pdf
npm install @vinevitable/html-to-pdf> npm i @vinevitable/html-to-pdf
You can use convertHTMLPdf to convert HTML strings to PDF.
Simply provide a array of html strings and saving path to function.
```
const {convertHtmlStringsToPdf, convertHtmlStringToPdf, convertHtmlFileToPdf} = require('@vinevitable/html-to-pdf');
try{
const htmlStrings = [
, convertHtmlStringsToPdf(htmlStrings,savingFilePathWithName).catch(error){
throw error;
}
} catch(error){
console.log(error);
}
try{
const htmlString =
; convertHtmlStringToPdf(htmlString,savingFilePathWithName).catch(error){
throw error;
}
} catch(error){
console.log(error);
}
try {
await convertHtmlFileToPdf(filePath, savingFilePathWithName)
} catch (error) {
console.log(error);
}
``Note:
``
use html {
zoom: 0.5 // user your choice of zoom to avoid big font in pdf
}
place this in stylesCurrently flex is not supporting use below flex to avoid the allignment issues.
display: -webkit-inline-box;
display: -webkit-inline-flex;
display: -moz-inline-box;
display: -ms-inline-flexbox;
display: inline-flex;
-webkit-align-self: auto;
or else use custom css in styles
Currently we are using default pdf attributes like below
format: 'A4',
quality: '100',
border: {
top: '0.3in', // default is 0, units: mm, cm, in, px
right: '0.3in',
bottom: '0.3in',
left: '0.3in',
},
Soon we will provide user input for the above attributes.
```