How to click element via Shadow DOM using VBA? - vba

Having opened this link in Chrome, I get to the PDF file that opens in Chrome.
On this page there are buttons for downloading, printing, etc:
When viewing the page code, it does not display any information on the download and print buttons.
When I do view the code by hovering the mouse over the download icon, the code for this button opens, which is not available through a regular DOM.
As I understand it, you can use Shadow DOM here.
How do I access the download button and click it to the VBA?

You could access the pdf by HTTP Request and save the data that way. The data is coming from the web, so it's going to be from a Request. You dont need chrome automated with VBA to do this action. Also Webdriver has good support: Downloading pdf file using WebRequests
idk if selenium has it, but i would search more if i were you and not use the DOM to download PDF by clicking elements.

Related

Access DOM embedded PDF in Chrome

Is it possible to access the DOM of a embedded PDF file opened in Chrome?
If you simply open the DevTools in Chrome, only the EMBED tag is visible:
But there is a mouse over PDF file opened in Chrome and right-click => code view, then a completely different page code opens:
Can I get access to it?
Thank you in advance!
Yeah so it looks like you've got multiple documents on a page. Its similar to iFrames in web design. I'm not sure 100% because I cant look through the link.
But I'd highly recommend downloading the PDF as a file, then using ADOBE Pro's library to scrape or w/e with the PDF functions. You eliminate the whole aspect of timing, page loads, and page changes, when you get a direct link to a pdf, and then manipulate the data on the user or cloud PC.

MVC print PDF without displaying in view with print dialog

I have an MVC app where the intention is for the the user to click Print, and in the subsequent print dialog, verify the target printer, number of copies, etc, and click Print. I'm rendering the PDF document and returning the document thusly:
return File(printJob.Bytes, "application/pdf");
This displays the document quite nicely in the browser. In both Chrome and Edge, when the user clicks Print, they get a preview of the page in the print dialog. So the user experience is they click Print, see a preview, click print, see a preview again and then click print. Does anyone know if it's possible to render the PDF document without displaying it in the browser and instead just present the user with the print dialog box?
Thx in advance!
When you return the PDF from your website, the browser is then acting as a PDF viewer instead of a web browser, so you need to get the PDF to request the print dialog on open, not the website.
You can achieve this by adding the document javascript this.print(true) into the PDF that you are generating.
You can test this in Adobe Acrobat by going to Javascript -> Edit All Javascripts and just pasting this.print(true) at the top outside of any named function.
Tested and working on Chrome, as soon as you open the PDF it displays the print dialog.
Acrobat Javascript Reference is here, the reference to the print function is on page 179.

Combine multiple "functions" in a pdf hyperlink?

I would like to know if it's possible to combine:
#target="_blank" and #page=4
In my case: I have a button in a pdf with a hyperlink asociated, when you press the link, it calls another pdf. The problem is that in Chrome, I need to press Control+click to open the link... so I want to force a "open in new tab" when clicking the button.
clicking on https://something.com/file.pdf#page=4 works but don't open on Chrome viewer
clicking on https://something.com/file.pdf#target="_blank" works but don't open in the page I want
So I need to combine both of them to open the link in a new window/tab on the page I want.
When you follow this link:
http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_open_parameters.pdf
You'll find a PDF document issued by Adobe where they describe the different possibilities for URLs going into PDF documents. They also describe how you can combine them, with the regular syntax also used for URL fragments, so I would try:
https://something.com/file.pdf#target="_blank"&page=4

Is it possible to have a hyperlink open in a new tab that is inside a pdf that is inside of a frame in classic asp?

I Have a classic asp site i am working on. The page has two frames one directly below the other. A Customer has to be able to view a pdf to continue onto the next page. To get to the next page they have to click on a hyper link inside of the pdf that is being viewed. If they cannot see the pdf then they have to download adobe reader which i have included a link to in the top frame.(The top frame has some text and the link) now the bottom frame(contains the pdf) this works fine except when i click the link that is in the pdf the page then opens in that same bottom frame that contained the pdf. It needs to be target _blank. Or whatever you would call it to basically either over ride the two frames and just open in the browser or open in a new tab or window which i cant get either to do. This problem is in IE and Firefox but in chrome it over rides the two frames and opens correctly. Is there any way to get this to occur in IE and Firefox?
I've found this resource about your issue:
http://forums.adobe.com/thread/853394
They say there's no target attribute to set. But they think (and i also think) that if you place a :
javascript:window.open('http://yoururl.com');
it should work, always if you can accept the security alert message (Abobe PDF is trying to execute a script... blah blah)
If your continue reading carefully it seems they solved the problem using Adobe scripting inside inDesign
Hope this helps...

Safari PDF controls missing PDF is rendered in iFrame

Anyone know why the PDF controls normally available when displaying a PDF in Safari would be missing when displayed in an iframe? Neither the "hover" controls or the extnded contextual menu is available. Safari reognized it as a PDF because the contextual menu includes the word PDF in the Open commands, ie. "Open PDF in new Window"
Opening a PDF into an empty browser works fine. The built in controls in Chrome and Firefox are there as well and work fine.
I am serving the PDFs using a very simple web page with an iframe inside a div.
I could be wrong but thought that they were there when I first started this project but I just noticed today that they are missing. Without them, PDF drawings cannot be zoomed in and out rendering them useless as PDFs.