Is it possible to create a pdf based on a view/page? For instance, a dispatch sheet. It would be nice to convert/export the page to PDF and print.
This is not possible at this time. We will pass this request along to our product team.
tldr; This is possible following these steps:
- Generate HTML using handlebars and any data to be included in the PDF.
- Use JourneyApps PDF generator library.
- JourneyApps API request to POST generated PDF to the desired model/field.
This is possible. However, it is a work around. There is a section in the documentation regarding PDF Reports found here.
The workflow is to use the PDF library created by JourneyApps to create the PDF. The example shows constructing an HTML page with the data desired to be converted to PDF via DocRaptor. I used HandleBars.
From this, you can create a PDF file. But, it's not a "screen grab" of the view. It has to be built using HTML and HandleBars. This can be both a pro and a con. It would be very nice to be able to just export the view to a PDF using a component. But, using the PDF reporting workflow with the JourneyApps PDF library allows the PDF to be customized. In my use case, this is okay.
Finally, the docs encourage sending the PDF via Email. This will work for many, but, for my use case I wanted to store the file in the JourneyApps database. There is no way to do this using a conventional DB call.
For example, it would be nice to be able to do the following
var file = generatedPdf; // PDF generated by JourneyApps library attachment.file = file; // attachment model in DB attachment.save();
It would be nice to save directly to the field of any desired model. This is not currently possible. The work around is to actually use the JourneyApps API to insert into the DB. So, insert the generated file into the model/field and save in the DB.
Not the best pattern. But, doable. Would love for this to be a feature to allow to directly insert the file to the database.