I do have a pdf embeded in to the page. It does work and it has it's own buttons, like print, download, rotate, zoom-in, zoom-out.
Is it possible to control these buttons from javascript? I want to show the pdf, but the buttons for download and print I want to control by myslef, with different design and placements outside of the embeded element.
TO sum up, I want to hide all buttons which is shown to the user from the default pdf viewer, except the page number, and I want to separately create donwload and print button with my own design but with the same functionality.
I've done a little bit of research and I found this: https://bugs.chromium.org/p/chromium/issues/detail?id=135146
which is yet has unknown status. Does it mean the API for Chrome pdf viewer doesnt exist? I couldnt fine any.
Another solution is to integrate PDF.js in my own web app, which is heavy (almost 2.6mb zipped) and time consuming.
Any idea is welcome.
Related
I'm working with vue.js, and I want to display a pdf on a website. I keep seeing a lot of complicated examples of pdf viewers that require an upload button and a conditional display - this is NOT what I need.
I just need to display a hardcoded pdf document within a div on my web page.
This is what I have so far using iframe
I need the width of the actual pdf page to fill up 100% of the width (for legibility). I don't want the grey background to show. The page should also be mobile friendly.
Open to suggestions that include not using iframe, especially if it would make the page more mobile friendly. If you're going to bring up vue-pdf or PDF.js, please include some clear instructions on how to use them.
PS: I am using some parameters to remove the toolbar and navpanes like so:
src="<MY PDF HERE>.pdf#toolbar=0&navpanes=0&scrollbar=1"
I've tried adding &zoom=100 or &view=Fit and that does not fix my problem.
Here is a list of all the parameters.
I lied. Adding &zoom=140 to the end of my pdf url solved my issue.
I am trying to display PDF file on the web without download option and copy option.
Then I found this https://books.google.co.in/books?id=kwBvDwAAQBAJ&printsec=frontcover&source=gbs_ge_summary_r&cad=0#v=onepage&q&f=false
Can you tell me how can I achieve this on my website?
What mplungjan said in his comment is correct. Anything that is put on the web can be copied one way or another. It appears that the google site you linked to is just showing an image of each page (see https://books.google.co.in/books/content?id=kwBvDwAAQBAJ&pg=PP1&img=1&zoom=3&hl=en&sig=ACfU3U0s8V3HjcApLeNwIGStMQlzZFaotA) with transparent pixels over each image to make it so you can't right-click to save the image. But it's easy to see what they're doing by viewing the source in the inspector.
If you don't want your users to be able to download the entire file, you could break it up into multiple small files (or images, like google is doing in your link) that would make it a little harder for them to get the files. But you can't really stop them from downloading anything.
My issue is that I have to deploy a local server (without internet), so I cannot use Google Doc Viewer in this case. All I want is to restrict the user from download or printing the document. I have tried hiding or removing the toolbar in JS but it is not working out.
You may be able to disable the toolbar somehow, but that isn't good enough to keep users from downloading or printing it anyway, and nothing you can do will be. If a person can see something, they can copy it, no matter what you try to do to stop them (and all trying will do is inconvenience legitimate users). Previous similar questions:
How to prevent downloading images and video files from my website?
disable downloading of image from a html page
https://graphicdesign.stackexchange.com/questions/39462/is-it-possible-to-prevent-download-of-images-when-designing-a-website
Although those talk about images, the exact same reasoning applies to PDFs.
If possible, I would like to do this with a simple button. The users are not terribly comfortable with computers, which is why I haven't just told them to print screen or use the snipping tool.
I know it can be done in Mozilla-based browsers with <canvas> and drawWindow(). But this application is running on Internet Explorer 7 and 8.
The page shows some graphs (generated by a ReportViewer control) based on the input of a couple of dropdowns. Does that mean a client-side script is the only option? Or could I do it in the ASP.NET back end somehow? Perhaps re-generating an image any time the dropdowns are changed?
(I've been a desktop dev for so long that I don't quite "get" what you can and can't do in web apps yet.)
From what I understand you've got some drop downs and you're generating a graph based on the input of those drop downs by the user?
So if I was doing this with PHP (just trying to give you ideas here, dunno whats possible and what's not in ASP) I would create an image magic or gdb library script that builds a jpeg based on the variables input in a querystring.
For instance this would output a jpeg image of a simple graph with 3 points on it:
http://mydomain.org/image.php?value1=10&value2=20&value3=30
Then for the front end of my script I would probably use jquery/ajax to call that script and show the image as the user is changing the values.
Then you have an image that you can potentially force download or instruct users to right click and choose "save as".
Anyway, this is just an idea, not a solution. I don't know about ASP.NET, but this is how I would do it in PHP.
I have a PDF embedded in a web page using the following code:
<object id="pdfviewer" data='test_full.pdf#page=1&toolbar=0&statusbar=0&messages=0&navpanes=0'
type='application/pdf'
width='500px'
height='350px'>
The PDF itself is set to open in full screen mode which shows no controls. The user can advance the slides by clicking on the view.
What I'd like to have is some way to trigger that click so that I can advance 2 similar PDF:s side-by-side (one for the actual slideshow and one for the speaker notes). Is this possible to do in javascript and/or jQuery? I have tried using the click()-method but it doesn't get through to the embedded PDF.
Update: Can't find any info on it, so I guess I'm out of luck and have to try a workaround. Am currently juggling 3 embeds of the same pdf (current page, next page and previous page), hiding and showing them and loading more pages as the user clicks around.
I doubt it. Allowing web page scripts to pass input events to the PDF viewer could be a security risk (since the viewer generally has access to system file dialogues via things like Save As).