Installation
To add this, simply run:
npm install harvest-profit-pdf
Or
yarn add harvest-profit-pdf
Usage
Like most Harvest Profit NPM packages, you can just include the pieces you need, and let your webpack tree shaking ignore unused code paths.
import {
HarvestProfitPDFHeader,
HarvestProfitPDFFooter,
PDFBuilder,
} from 'harvest-profit-pdf';
import saveAs from 'save-as';
export default function generate() {
const builder = new PDFBuilder({
header: new HarvestProfitPDFHeader(2017),
footer: new HarvestProfitPDFFooter({
message: 'Something here'
}),
margins: {
bottom: -30,
left: 30,
right: 30,
top: 30
},
subHeadingFontColor: '#555555',
subHeadingFontSize: 10,
includePageNumber: true,
title: 'Harvest Profit Is Awesome'
});
builder.generateBlob().then((blob) => {
saveAs(blob, 'Test.pdf');
});
}