IMG to PDF conversion - Mendix Forum

IMG to PDF conversion


Here is an idea of how to convert image to PDF file, and download or print it if necessary. 

For this action you will need to retrieve an image, or in our case – two images. We have a bank check which returns with front and back view. That views are returned as Objects in the MF, and after they are populated through the Page Template. 

For the PDF conversion we use an action Generate Document right after Object change in the MF. As a File we use check front (the argument passed is the Transaction object which already contains 2 images: front and back), as a Document Type – PDF, as a Template we create a new Template. After Generate document action in the MF, we use Download file.

Page template.

For the Data View we pass the main Entity, which is responsible for the transactions information. For the Template Grid we pass an association of that Entity and Entity of the checks. Inside the grid, we populate a Dynamic Image Viewer, where we pass a check Entity itself. 

Using this method of the Generate Document through Page Template, we put an image into the PDF file. After that, we can download that file or open in the new tab, download, print or close it. 

0 answers