Microsoft Edge PDF Viewer Extension Location - javascript

I am interested in messing with the built-in PDF viewer of Microsoft Edge. I know you can inspect its files in the Dev console, but I would like to know where these files are actually located so I can change them to alter/add some functionality.
Another possibility would be to run a user script when a PDF is loaded, but tampermonkey does not seem to work when a PDF file is opened in Edge.
Why I want to do this: I would like to see whether I can implement additional functions that I'd like to use in the PDF viewer. I know there are pdf js libraries out there, but I feel like none of them display pdfs as nicely as Edge does and I haven't found one that allows drawing on pdfs.

You can see the edge_pdf source code by inspect the page ,then click the Source panel, it show all the resource which edge_pdf loaded.

Related

Google viewer is opening blank page frequently

Why Google Viewer sometimes is opening a blank page instead of open the PDF file?
I could simulate it using this code. It doesn't happen every time. It will be necessary to click on the Google Viewer button few times.
I could simulate it on Edge and Chrome.
Pay attention to the two tabs after the tab title "Sem títlulo". They opened the PDF file perfectly. However, the tab with the title "Sem título" did not open the PDF.
EDIT
I'm using google docs viewer https://docs.google.com/viewer.
I try to test your code on the MS Edge legacy browser, MS Edge (Chromium) browser, Google Chrome browser, and Firefox browser.
I can reproduce the issue on all 4 browsers. So we can say that this is not a specific browser related issue.
I noticed that you are using Google docs viewer to display the PDF.
https://docs.google.com/viewer?
I try to display the PDF directly in the browser and found that it is working fine in every browser.
Test code:
Click to open PDF
Here is the test results in MS Edge (Chromium) browser.
So it looks like there is some issue with the Google docs viewer. You can try to provide feedback to Google about this issue.
To fix the issue in your code, you can try to directly display the PDF file as I show you in my sample code. You can notice that performance is also better.

Disable pdf download and save option

I have a PDF file being viewed on the browser.
I want to disable Save, Download and print option of the PDF file.
Please help.
Try this:
<object width="100%" height="100%" type="application/pdf"
data="yourpdffile.pdf#toolbar=0" id="pdf_content"><p>Document load was not
successful.</p></object>
Make sure you add #toolbar=0 in the data attribute after your pdf file.
You can use iframe to your own version of PDF viewer.
Use pdfJS and when showing viewer.html just remove these buttons.
If user is viewing it on it's own tool, than you can't control it.
Google Drive can disable the PDF functions to download, print and copy as of 2015.
Note however, that users can still print using the browser print function.
https://gsuiteupdates.googleblog.com/2015/07/disable-downloading-printing-and.html
As others have noted, once the pdf is being viewed by the user, they can save it.
If you are just wanting to obfuscate the download, you could disable the menu as described but to truly prevent downloading of the PDF, then only thing you could really do is a little crazy but not impossible.
You could convert it to images and show those instead. Not an ultimate solution as they would still be able to save each image, but at the very least they would not get a PDF file from it (or at least if they are smart enough to convert the images to one, it would not be the same pdf file or content)
There are many tools to do this and you'd have to implement a viewer with paging but this might achieve what you want.

Chrome "Drop workspace folder here"

While developing some JavaScript using Chrome 38.0.2125.122 m Developer Tools, I clicked on an error in the JavaScript console and was met with the following message:
Drop workspace folder here
Why isn't Chrome taking me to the offending line on the offending file, as usual? What is a workspace folder? What am I expected to do?
Seems like it is another way to add a workspace to the DevTools (another way of doing this: https://developer.chrome.com/devtools/docs/workspaces#).
It happened for me when I dragged a file to an open browser page and the file was accidentally dragged over the open DevTools. If you want this to go away you can drag and drop a dummy file. This way there is no need to restart Chrome.
This happens in recent versions of Opera browser too.
For me it happens when I drag a file or folder over any part of the dev panel, even while it is behind other programs or folders.
The prompt does not always stick, but when it does, dragging any file off my desktop back over the dev panel usually un-sticks it. It doesn't seem necessary to drop the file in the prompted area, but that works too.
In addition to Alexandra's answer link, there're discussions on the GoogleChrome git pages discussing 'workspaces'.. personally I don't use it, I prefer a full editor.

How can I get the x, y dimensions of a PDF Image

As you can see in the image above, the dimensions are embedded somewhere, but I know not where. Is there a utility which I could call through shell to determine the dimensions of the PDF?
Any help is appreciated.
I used Visual FoxPro above with a browser ActiveX in a form to display PDFs HTMLs etc..., I can use any shellScript or EXEs, dlls etc, if anyone knows how to do this....
Is Javascript able to look into a browser like FireFox which has a PDF displayed, to get the dimensions???
DKean

Disable Chrome Extension Minification

I've been working on a Chrome extension and I have a minor annoyance with debugging my scripts. My background page is a Javascript file and it is always minified automatically by Chrome. You can see how this becomes a pain to use the developer tools on because everything is on a single line. Anyone know if this can be disabled?
To view your Chrome extension source normally:
1 open Chrome's extension management page
2 make sure developer mode is checked
3 click link after inspect views to open extension files in chrome developer tools window
4 click link to included script file in background page to view background script
Perhaps this is relevant.
http://www.elijahmanor.com/7-chrome-tips-developers-designers-may-not-know/
The ability to Pretty Print ( a.k.a. unminify ) JavaScript source
Sometimes I'm trying to figure out a bug and unfortunately the JavaScript that was included has been minified. As you are aware trying to debug a minified file is nearly impossible. How do you set a break point on a line that is a bazillion characters long?
Thankfully Chrome has a Pretty Print feature that will take a minified JavaScript file and format it property. All you need to do is to click the "{ }" icon on the bottom toolbar to activate this feature. Of course the names will still be obfuscated ( depending on what program minfied the JavaScript in the first place ), but you will at least be able to set break points and debug the code.

Categories