Access DOM embedded PDF in Chrome - vba

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.

Related

Is there any way to display in-line PDFs in Firefox?

Quick description - My company has a webpage that we use for responding to emails and assigning them to people (team inbox basically). The page converts all attachments (that it can) to .pdf files and each attachment/page gets converted as it's own separate .pdf so we can navigate the pages easier (I guess? At least there's a way to merge them into one file, but that opens in a new tab). These .pdf files are displayed in-line. Currently I have to use another browser for this page, due to Firefox not supporting in-line PDFs. Can anyone please advise if they have found a way to view in-line .pdfs within Firefox? Thanks in advance.
See these pics for reference -
In-line .PDFs displaying in Edge (Chromium)
Firefox not displaying
Firefox actually supports embedding PDFs in <iframe>. So this might be a problem with how this web app is written.
This example page shows it working in Firefox: https://www.w3docs.com/tools/code-editor/1077

How to click element via Shadow DOM using 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.

Edit texts in a PDF on Chrome using Chrome inspect

Is there any way to modify texts in PDF on Chrome using the Chrome inspect tool? I was stuck because in the Chrome inspect element, differently than any other websites and even PowerPoint presentations opened in Chrome, I'm able to modify texts, while with PDFs I cannot. Does anyone know how to do it?
Edit: Yes I know that the changes made through Chrome DevTools are temporary, but usually I'm able to make those changes, even if they're temporary. But with PDFs I can't.
There are differences in the way some browsers handle PDF data.
Chromium based browsers are more traditional in that the PDF plug-in is based on a Foxit/Skia collaboration, So you need to understand in that case, the downloaded PDF you are viewing is in the binary application/pdf (file already outside of the html wrapper).
Just as you cannot edit the PDF text in Acrobat Reader, the most you can do is incrementally add comments/annotation or field data to the end of the file, before save as a secondary download. The server cannot see your changes unless you submit as an upload.
With Firefox and Google docs there is often a different approach where the PDF is "Repr"oduced as an "Ex"ample (A ReprEx of the PDF) so it is built of a hybrid image and text overlay to emulate that part of the real PDF source. When you previously or later save the underlying downloaded PDF (for viewing) it would not necessarily include any browser based HTML editing, in the saving.
There are other techniques for other cases, but to answer the basic OP question most simply, the answer is NO you cannot change a PDF body, only add notes, etc via extensions. Microsoft variant of Chrome I.E. Edge has some inbuilt annotation ability thus does not need a second extension.
Found this question because I was googling a similar situation--I was wanting to manipulate type sizes and margins on a PDF in inspector via Chrome. I found that FireFox DevTools will allow you to view those styles and even alter the content in the PDF while in browser. I am late to the game but hope this provides answers for someone else in the future.

Disable PDF printing in Firefox by web developer

I am developing a web page to show PDF (in .NET platform). The PDF is inside a iframe. One of the requirement is NOT allow client to print the PDF. I have already made the PDF to be password protected (with pdfsharp). I further hide the toolbar by setting toolbar=0. In Chrome & IE, this works fine. But for Firefox, the story is totally different.
In Firefox, the toolbar will be shown even append #toolbar=0 in the src link. Further, the password protected pdf can be printed by simply clicking the icon in the toolbar.
Can anyone suggest some ways to disable pdf printing in firefox.
Note: I need to show the PDF in the webpage. So, download the PDF is not a option.
You will not be able to control the toolbar or the ability to print (not all PDF viewers respect the permissions set by the password) if you rely on the native browser or OS level PDF viewer by using an iFrame. Different browsers will interpret those settings differently. Even different applications within the same browser will yield different results (Chrome vs Dropbox in Chrome)
You'll need to display the PDF using something like PDF.js or another such library if you want any kind of consistency in appearance and behavior.

How can I open any PDF link on a page in a popup Lightbox?

I will have a page that will regularly updated by a client (using something like TinyMCE), adding links to PDF files that I want to open in a lightbox on the page. Does code to make this a lightbox need to have the link of each PDF inside it or will the code cover any PDF links on the page? I am relativly new to lightboxes in general and was wondering if this is possible, thanks.
I believe PDF is too much for lightbox, use ThickBox with iframes instead.