@journeyapps-solutions/pdfgen-sol
v2.0.4
Published
Pdf reports generator and mailer
Keywords
Readme
pdfgen-sol [DEPRECATED]
Pdf reports generator and mailer
Note, docraptor use has been deprecated in favour of the Journey Apps Document conversion in version 2.0.0. Updating your documents:
- Install latest version of pdfGen
- Update you page margins to ensure the correct margins by using
config.printto set the margins on the pdf generation and removing @page in the styles. - Add
process.env.JOURNEY_PDF_KEY = this.backend.token;to your task to ensure the PDF generator gets the current running token
It should be noted that upgrading the v2.0.0 will likely cause some stylistic differences, as PDFGen is now using a new processor for the PDF generation. We've seen font and border weights, as well as padding, change, so make sure you plan in some time to process those differences.
Usage
In the task:
config.js:
config.EXPIRES_AFTER = 86400 * 7;
config.AWS_ACCESS_KEY = '...';
config.AWS_SECRET_KEY = '...';
config.DOCUMENT_BUCKET_NAME = 'journey-docraptor';
config.DOCRAPTOR_API_KEY = '...';
config.SENDGRID_API_KEY = '...';index.js:
// make sure config.js has the relevant credentials
const config = require('./config');
const PdfGen = require('@journeyapps-solutions/pdfgen');
export async function run() {
const pdfGen = new PdfGen(config);
const pdfHtml = '...';
const emailHtml = '...';
pdfGen.addReport(pdfHtml, 'JourneyApps Test Report');
const recipients = [
{
name: 'Test User',
email_address: '[email protected]'
}
];
await pdfGen.mailReports(recipients, emailHtml);
}Development
Publish a new version requires:
- Updating the package.json version
- PR into master if code not already in master branch
- Creating a release on github. This will trigger a Github Action to publish the package.
