Adding an image to an input field when creating a patient letter
Submitted by gretalloyd on Wed, 10/04/2019 - 21:17
Hi,
We use one standard document for many procedures and use the input fields to personalise the letter. I would like to be able to add an image from file at this point, without opening the document, as the only way I can see to add an individual image to a patient letter is to open the document->insert->picture->from file.
To add the image at the time of creating the patient letter, I'm thinking something like having images saved as macros (ie the tplojpg is an image of a standard tplo)
Is there anything like that available or any other ideas?
Re: Adding an image to an input field when creating a ...
I don't know that its possible with OpenOffice or Word templates.
It is supported in JasperReports. The attached template takes two parameters, an image path and some text.
These will both be included in the generated PDF.
To try it out, create a new Document Template in Administration - Templates, set Type to Patient Letter, and upload the attachment.
Once loaded:
This will prompt for 2 parameters:
Click OK, and the PDF will be generated.
This is just one way of doing it. Rather than taking the path to the image (which could be generated by a macro), you could use a name that the template uses to get the correct path (e.g. tplo).
Alternatively, you could use multiple reports, one per image. To reduce duplication, the main report would just be a stub that selected the image to use. The sub report would include the letterhead and common text.
Re: Adding an image to an input field when creating a ...
Thanks Tim. This is really cool, but I can't get all the functions that are in my current openoffice document to work in the Jasper report. Good to know for in the future if I learn more and able to work out the functions.
Greta
Re: Adding an image to an input field when creating a ...
All of the functions in your OpenOffice document are supported in JasperReports.
They are also faster to merge, and are more flexible.
One limitation is that they generate PDFs, so if you want to be able to edit the merged document, OpenOffice is the way to go.
If there is sufficient interest, we could add support to generate OpenOffice/Word documents from JasperReports.