Including Image Attribute in PDF Download

0
Hi everyone, I'm currently working on a feature in my Mendix application where users can download a PDF document containing information about processed claims. I've successfully implemented functionality to include text attributes such as ClaimNumber, PolicyNumber, UserName, and VINNumber in the PDF document. However, I'm facing challenges in including the Images attribute in the PDF. I'm unsure about the best approach to handle rendering images within the PDF document. Here's an overview of what I've done so far: I've retrieved the necessary data from my Mendix entity. I'm using the Mendix PDF module to generate the PDF document. For text attributes, I've replaced placeholders in the PDF template with the corresponding data successfully. Could anyone provide guidance on how to properly include the Images attribute in the PDF document? Any insights or examples would be greatly appreciated! Thanks in advance.
asked
6 answers
0

Just develop it like a normal Mendix page where you want to show an image;

 

Make sure that your image object is available on the Mendix PDF page. You can do that by retrieving it with a microflow, by association (if you have an input object in your PDF) or passing it to the page.

 

Add a data view with the entity of the image object and add the 'Image' widget to your page. This widget will show your image in the PDF, if the object is available.

 

 

answered
0

Thank you for your suggestion. I've followed the steps outlined, but I'm still facing difficulties with including the Images attribute in the PDF download. Here's what I've done: Developed the Mendix page as suggested, including the Image widget within a data view associated with the entity containing the image attribute. but i am getting an error like, for your reference i have attached the image which i got.ImageProcess.PNG

answered
0

As far as I can see, you are using a document template to configure a PDF. This is the 'old' way of generating a PDF and it's really hard to configure and maintain.

 

If I were you, I would download the new PDF module (here), which is way easier to use. They explain everything step by step and very clear (here). If you follow it once, you will notice it's way easier to use, because you just have to develop a Mendix page, instead of a Page template.

answered
0

I have followed the steps you mentioned above for including images in the PDF. However, it is not working. For this, I have created two microflows: the first one for the claim new edit page, and the second one for generating the PDF document. When I try to click the 'Print' button, I get an error. For your reference, I have attached a screenshot. Could you please review it and get back to us?.error.PNGgeneratepdfpage.PNGds_pdfmicroflow.PNG

answered
0

could you add error handling in the java action share the stack trace of the error or latest error ?

answered
0

Did you enable PDF export for the page?

 

Go to the page properties > tab 'Appearance' > 'Enable PDF Export' to Yes

answered