UiPath Form Task display multiple PDFs dynamically

I’m working on a process in which the robot needs to download some PDFs from a web platform (the number of files can vary from one item to another) and then display them all within one form task (they will serve as an element for decision-making). How can I display all PDF files dynamically?

I was thinking about maybe link the data.variable inside the HTML content with values in dropdown list that will be dynamically populated with the number of PDF file paths downloaded (string variables).

Does anyone have any idea how I could do this please?

Hello @mthspessanha!

It seems that you have trouble getting an answer to your question in the first 24 hours.
Let us give you a few hints and helpful links.

First, make sure you browsed through our Forum FAQ Beginner’s Guide. It will teach you what should be included in your topic.

You can check out some of our resources directly, see below:

  1. Always search first. It is the best way to quickly find your answer. Check out the image icon for that.
    Clicking the options button will let you set more specific topic search filters, i.e. only the ones with a solution.

  2. Topic that contains most common solutions with example project files can be found here.

  3. Read our official documentation where you can find a lot of information and instructions about each of our products:

  4. Watch the videos on our official YouTube channel for more visual tutorials.

  5. Meet us and our users on our Community Slack and ask your question there.

Hopefully this will let you easily find the solution/information you need. Once you have it, we would be happy if you could share your findings here and mark it as a solution. This will help other users find it in the future.

Thank you for helping us build our UiPath Community!

Cheers from your friendly
Forum_Staff

I populated a dropdown list with a list of strings (pdf paths). Now, I want to display the selected pdf from the dropdown list in the HTML content (iframe). How can I perform this? Does anyone have any idea which logic should I use to enable this dynamic display?

@mthspessanha,

I do not know if you can do it in an async way (should be definitely possible), but a basic approach would be to create a simple javascript function to toggle a refresh when a selection is made and you could change the link to be accessed. I have used a similar approach (dropdown + iframe for images) with images and a flask server in python, so it should be possible with pdfs too in iframe.

How to Embed PDF Document in HTML Web Page - CodexWorld

Use of UiPath robot in your workflow here, I am not so certain. May be a little overkill.

Hope this helps!

Thanks for your reply.

Do you know how can I change the link inside the src attribute on dropdown selection?

Knowing that this link is an element of a variable of type list of strings.

I’m interested if you can share your workflow for images, it should be the same approach.

Hi @mthspessanha,

No UiPath licenses were harmed (used) in this approach :smiley:
Part 1: The input from the user is captured and onchange a javascript function “updatepdf()” is triggered.

<label for="file">Choose a pdf file:</label>
<select name="files" id="selectpdf" onchange=updatepdf()>
  <option value="1">Testfile1.pdf</option>
  <option value="2">Testfile2.pdf</option>
</select>

Part 2: Lets show the PDF in a iframe

<iframe id="showpdf" src="Testfile1.pdf" width="100%" height="500px"></iframe>

Part 3: Lets define the updatepdf() function. Here we get the option number of the choose dropdown value and we use the value of that index (in this case I have used file name with extension) you may need to add the extension string separately depending your code.
The last part is to just change the value of id=“showpdf” iframe to the selected value.

    <script>
    function updatepdf() {
        var e = document.getElementById("selectpdf");
        var strUser = e.options[e.selectedIndex].text;
        document.getElementById("showpdf").src = strUser;
          }
    </script>

Here are the demo files and the HTML file: LinkChange.zip (14.0 KB)
Just open the html file and you can test it out. I have used a single file for all HTML, CSS, and Javascript in ChangeLink.html

Hope this helps, cheers!

1 Like