cmi
Rookie

Generate PDF having images from File upload control

Jump to solution

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

Labels: (1)
0 Kudos
Reply
2 Replies
Jake
Nintex for Sharepoint Expert
Nintex for Sharepoint Expert

Re: Generate PDF having images from File upload control

Jump to solution

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:

 

Jake_0-1650875112539.png

 

 

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. 

 

Jake_1-1650875162160.png

 

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

 

Jake_2-1650875260314.png

 

 

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.

 

Jake_3-1650875356146.png

 

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.

 

Jake_4-1650875420890.png

 

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

 

Jake_5-1650875522337.png

 

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

0 Kudos
Reply
cmi
Rookie

Re: Generate PDF having images from File upload control

Jump to solution

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

0 Kudos
Reply