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?
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:
Always search first. It is the best way to quickly find your answer. Check out the icon for that.
Clicking the options button will let you set more specific topic search filters, i.e. only the ones with a solution.
Topic that contains most common solutions with example project files can be found here.
Read our official documentation where you can find a lot of information and instructions about each of our products:
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!
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?
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.
No UiPath licenses were harmed (used) in this approach
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 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