On the Google I have opened a website and I clicked on the download pdf button, It opens pdf in another tab, When I send hotkey control+P it saves the first tab instead of second where the pdf is being used. I tried changing idx=‘2’ for second tab, then also it is not printing the 2nd page.
@Keshav_Choudhari A better approach is to explicitly switch focus to the PDF tab before sending Ctrl+P. You can do this by using an Attach Browser or Use Application/Browser activity that targets the PDF tab itself, usually identified by the PDF URL or title, and then send the hotkey inside that container. Another reliable option is to avoid printing via hotkeys and instead download the PDF directly to disk and handle it as a file
After the PDF opens in the new tab, attach to that tab using Use Application/Browser and then use Get Browser URL to read the current URL of the tab. Store that URL in a string variable and then use Download File or HTTP Request with that URL to save the PDF locally. This works because the browser URL itself points to the PDF.
@Keshav_Choudhari Before clicking on download pdf button check for href of the file or observe the url of the file that is opening in 2nd tab. If there is any specific pattern like the static url + file name, prepare the url nd use the http request or file download activity to download the file
Actually whenever I click on download pdf each time a new tab opens with different blob url.
Like this : “blob:https://ilounge.royalsundaram.in/20d4958c-2ae8-4bb0-9b2e-44037d27e12b”.
If I use the attach browser on the active tab (where the pdf is opened), each the time the url is changed.
Got this error : “Download File from URL: The ‘blob’ scheme is not supported.”
Yes, I have tried that too, I switched focus on another tab and also it is highlighted but it still downloaded the 1st tab only.
May I know what is constant in this url
And what is changing dynamically
hello @Keshav_Choudhari ,
UiPath is attached to the original browser tab, not the PDF tab. idx won’t work for Chrome PDF viewer. You must attach the PDF tab before Send Hotkey (Ctrl+P) or download the PDF directly instead of printing.
Regards
Dherandra Vishwakarma
20d4958c-2ae8-4bb0-9b2e-44037d27e12b
this changes everytime.
Use wildcard and replace this with *
I cannot download the pdf directly as on clicking the download button it opens in another tab, and also click activity does not work for clicking on the download button on the pdf page.
Try this
Like this : “blob:https://ilounge.royalsundaram.in/*”.
hello @Keshav_Choudhari ,
you said very well you can also try
two send hotkeys as
- Click download button
- ** Give Delay (1–2 sec)**
- Send Hotkey → Ctrl + Tab (switch to new tab)
- Send Hotkey → Ctrl + S
Regards
Dheerandra
“https://ilounge.royalsundaram.in/iPolicyMotor/vehicle-summary/25018180627”
Hi, even after I indicate the 2nd tab (pdf page ) it takes the above url, and that url is actually for tab 1, even If I change the selector it is still taking the first tab url only.
Try this approach
1.Click Download PDF
2.Wait for the new tab to open
3.Use Application/Browser
4.Indicate the PDF tab
5 use tab title (usually contains “.pdf”) or pdf url
6 Inside this container - Add Send Hotkey → Ctrl + P
Cheers
You can try this approach of @Dheerendra_vishwakarma
Should work
instead of clicking on the download button
- Use get attribute on download button and get the href property
- Use go to url or navigate browser and pass the output for step 1 here
- this ensures the pdf is opening in same tab then you would not have any issue as well as there is only one tab
Hope this helps
cheers
As an alternative to trying to navigate the correct tab, you could consider flipping on the switch for “Ask where to save each individual file” in Google Chrome.
In that way you should be able to download the file and open it in a PDF reader application (such as Adobe or Foxit Reader), by using a Use Application/Browser container, and performing your printing from there.
Regards
Soren
Hi @Keshav_Choudhari ,
I agree to the approach suggested by @SorenB. I would have suggested the same way to make changes in browser settings, in order to download pdf to your desired location.
I have used this approach in my projects and it works completely fine and smooth.
adding to @SorenB point
you can change the pdf setting in Chrome itself, instead of opening the PDF file in new tab, it will save the PDF file. Depending on the setting mentioned by Soren, chrome will give pop up to download the file or it will save the file directly.
Navigation> Menu > Settings > Privacy and Securities > Site settings > Additional Content Settings > PDF Documents
