I'm going to write a site that lets users to view pdf files but I don't want them to save the files to their own hard drive due to the copy right law. I'm researching how to view it by using PHP, but I have no idea how to disable user not to download the files.
Actually, I want to use JavaScript to disable this action, but I get suggestions from other people not to do so because it's annoying to user.
So any suggestion or help would be very much appreciated.
USE CSS opacity: 1.0 with a <div> positioned over your content...
You could output the pdf using <object> or <iframe>, then place a with absolute position and use z-index to cover your pdf. Use the css opacity: 1.0.
Now when users try to click or copy, they get nothing because they are really clicking on a blank <div>!!!!
Its a hack, but it works! The user will be able to read the content, they could take a screen shot, but they won't be able to actually copy the text and paste it anywhere.
Method 01
Implementing that useing Google books
<iframe frameborder="0" scrolling="no" style="border:0px" src="https://books.google.com.kh/books?id=e5MkzETNcsgC&lpg=PP1&dq=typography&pg=PA11&output=embed" width="500" height=500>
</iframe>
In above image it shows Embed that will be the code. And Download or Print option is not available on this. Google dosc can prevent download but its allow to Save to Drive option. Then in drive i can download it. But Google books not allow any of that.
in view
Method 02
Using Google Drive
Right click on pdf and goto Share(below image)
Then go to Advanced option in left bottom
Tick Both check boxes. After copy embed link and paste it to your src. No download and Save drive option is not allowed
Note: Method 01 and Method 02 is Tested
You can't prevent your visitors from downloading, copying or scrapping anything you're outputting to their browsers. If they can view it they can always screenshot it. Which brings in the optimal solution to your problem: Simply offer image copies of your documents instead of actual PDF files. You can convert / mass convert PDF files to JPEG easily with Photoshop.
I hope I am not very late to reply. But here's is something you can do to prevent the users. Use iFrame to display your PDF and make sure that you are displaying using Google. I used the following code :
<iframe src="http://docs.google.com/gview?url=http://www.tutorialspoint.com/php/php_tutorial.pdf&embedded=true" style="width:600px; height:500px;" frameborder="0">
</iframe>
Here you can simply change the url=http://www.tutorialspoint.com/php/php_tutorial.pdf and replace it by your own URL where you kept your PDF.
Try this one:
<iframe src="test1.pdf" scrolling="no" frameborder="0" height="100%" width="100%" style="position:absolute; clip:rect (190px,1100px,800px,250px);">
try this
<embed src="http://URL_TO_PDF.com/pdf.pdf#toolbar=0&navpanes=0&scrollbar=0" width="500" height="500">
Related
For some reason with the following embed code:
https://docs.google.com/gview?url=<?php echo $url;?>&embedded=true
I have been getting a no preview available. It was working, and now it doesn't seem to.
Is there a good alternative where I can view PDF and Office files?
Thank you!
You may have an old version of the viewer URL format. Here's a different link format that's documented in a GitHub gist.
https://docs.google.com/viewer?url=http://infolab.stanford.edu/pub/papers/google.pdf&embedded=true
If you want to embed it within a page, you can use an iframe.
<iframe src="https://docs.google.com/viewer?url=http://infolab.stanford.edu/pub/papers/google.pdf&embedded=true" style="width:600px; height:500px;" frameborder="0"></iframe>
After much looking, I found a solution, I used the standard PDF viewer with an iframe.
I have following code
<iframe src="https://player.vimeo.com/video/250356669" width="740" height="370" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen="" __idm_id__="321146881">
</iframe>
It is my requirement to use only Vimeo videos so my question is how can I encrypt the video URL so that no user able to see that URL from where the video is coming from?
My requirement
<iframe src="something-ecrypted-instead-of-vimeo-url" width="740" height="370" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen="" __idm_id__="321146881">
</iframe>
Any help will be aprecaited.
Thanks.
Its worth noting firstly that the URL in your example is not a video URL but a URL to HTML 'page' which is inserted into your iframe. This HTML includes the HTML markup, player etc as well as the actual video URL for the video which will play.
If you just want to change your code so the code on your page shows no mention of Vimeo you could have an URL in the source for a proxy on your server which then redirects to the Vimeo URL.
However, as others have pointed out in the comments, this will not really divert or fool anyone who might actually want to understand the page or look at the source as it is very easy to follow the links or to monitor the network activity on a browser. IN very simple terms, if it is sent to your browser then someone can capture it.
If you are concerned with someone copying your material, then the standard approach is not to try to prevent people finding it, but to encrypt it and protect the keys with some sort of DRM mechanism. Vimeo say that they support DRM for 'select Vimeo On Demand partners' - not sure what exactly is needed to qualify for this.
I am working on content oriented website and using I frames to display pdf.when I am opening that page in the mobile browser it starts automatically starts downloading the pdf,how could I display pdf file using iframe in browser instead of downloading.
Now i am thinking to convert pdf's into HTML and pass HTML file as source in frame.
Suggest me some other alternative if I'm wrong and if I'm right then suggested me some pdf to HTML convertors,which can convert in bulk as I have very large number of files.
**EDIT:**thanks,it worked but can how can i stop it from being download,i'm thinking of disabling right click,will it work
One thing you can do is to upload your PDF somewhere and just use its URL.
You can also use Google PDF viewer for this purpose.
For more information check this Recommended way to embed PDF in HTML?
There are many ways you can make this possible one of them would be use the following <embed> element with source link to your pdf file :
<embed src="http://example.com/yourfile.pdf" width="1000" height="500" type='application/pdf'>
Another one is you can use the javascript library also :
pdf.js
and one last i have in mind is you can use google docs api url to view the : docx,doc,xls,pdf,ppt or any other document file online by using the method below:
https://docs.google.com/viewer?url=http://example.com/yourfile.pdf
This is a progress after the question Embedding Image/Video Stream into webpage that was answered for the picture only using curl, video is still an open issue.
Resuming, I need to avoid that the visitor of a web page see the real source of an image streming. So I want to embed the video a some wrapper php page that doesnt use any userid/password but is under my control. Embedding the video stream into any HTML page it's really easy:
<img src="http://5.246.77.89:8090/videostream.cgi?user=stack&pwd=overflow&resolution=32&rate=15" alt="">
For some time I'll give you the opportunity to test the source of the video streaming that I want to hide here
http://93.58.198.189:8090/videostream.cgi?user=stack&pwd=overflow&resolution=32&rate=15
Now all I need is a simple web page let say video.php that is able to stream the video without asking credentials and hiding the original source IP, something like
<img src='my.php'>
How can I obtain this behavior?
Note that despite the source is a video stream, the header is image/jpeg as you can see by yourself and it works with any browser. I've tried to use
<?php
header("content-type:image/jpeg");
passthru("http://93.58.198.189:8090/videostream.cgi?user=stack&pwd=overflow&resolution=32&rate=15");
?>
but for some reason doesn't work. Any idea?
Good question, i was also had a same problem.
Now its solved for me. just you can go to you tube video url where your video is stored and below the video there is share ad embed, you go to embed and there you will get a url which can be embeded to your video.php. it works.
Here is the image :
So now how do i show only the "Red Boxed" part in my frame.
So is there any way i can position my frame or something to that dimensions ?
The short is that if you want to do it with google, you can't. (show a specific part of it)
To show all of it you can:
<iframe src ="http://google.com" width="100%" height="300">
<p>Your browser does not support iframes.</p>
</iframe>
See iframe
You can modify the width and height but you can't say where to start showing (because it's not you page).
The only thing you can do is put some div over it covering some parts
IMPORTANT, THIS IS JUST AN EXAMPLE
From Google's guidelines: Don’t frame or mirror any Google page (including the page that appears in response to a click on the Google logo or Google search box).
Thanks #Gordon!
Good luck!
with PHP you can retrieve the html and than quite easily edit it pragmatically.
Or try and use HTML FRAME Attributes... http://www.w3schools.com/tags/tag_frame.asp
The latter will only work if you try to get a part of your own page, and not google's..