Skip to main content

Hi,

I need to generate a PDF which embeds images uploaded with File Upload control

It works ok with signature control or image, but not manage to map with File Upload.

Any help?

Thanks

Hi @cmi 



 



To be able to use file uploads as images in document generation you need to be able to anticipate the images.



 



To ensure that only images are uploaded into the attachments field I would restrict the file type to images:



 





 



 



You also need to think about how many images you would want to have from the upload, if it is a single image then the process is simple and you should restrict the maximum files in the control to 1. 



 





 



When you save the form and return to the workflow, the image for the upload will be in a collection.



 





 



 



This is done in assumption of multiple possible images and is normal behaviour, however this cannot be used as an image for document generation so we need to get the image file from the collection before we can use it, you can do that with these set of actions:



 



First create a new file type variable and name how you wish.



 





 



Then use the Get item from collection action to populate the variable with the uploaded image, the index used is 0 for the first and only item.



 





 



Now your image is stored in a file variable it can be used in the generate document action



 





 



To be able to handle multiple images can be a little more complex but follows a similar line to this process.



 





  1. You need to define a maximum number of images possible because this is important to prepare the workflow to be able to handle the images.


  2. You will need to create a file variable like above for each possible image, such as Image 0, Image 1, Image 2 etc, I would also create a boolean variable for each image to state if it is used or not for later.


  3. Then instead of using the Get item from collection variable you use a loop for each, which essentially works in the same way but for multiple items.


  4. Inside that loop you would then set the relevant variable based on an index, this essentially splits the attachments up for you and also set the boolean value as true.


  5. In the loop you also specify if the image is in use, this is needed to ensure the document generation takes place correctly as placeholders need to be either replaced or removed. 


  6. Then you add all of the file images to the document generation action.


  7. In your document generation template you need to use a word formula to wrap each image placeholder with an IF statement, checking the boolean we created above.


  8. IF the image was uploaded then a true value will return and the placeholder with the tag will appear in the document, IF the image wasn't uploaded for that number it wont appear and wont surface the placeholder.




 



If your requirement does need multiple image uploads and you would like assistance following the instructions above then please reach out to me via your account manager and I will be happy to jump on a call to help you out.



 



Kind regards



Jake


Hi Jake,



Thanks a lot clear explanation.



Figured this also



Still when 40 images are to be integrated, doing this one by one is quite heavy


Hi, Im needing help with multiple images. 

I have a loop for each that captures each image uploaded and then a store a file action that saves them in a sharepoint library. 
I then have a second loop for each as mentioned in step.4, though I cant get the configuration right.

Any help will be appreciated


I can get it to work without the loop and have instances of Get Item from Collection, though I cant get the place holder images to work on my doc template either.. ?


Reply