[英]Hide pdf toolbar with pdfjs with laravel 5
Please I need to be guided on how to remove the pdf toolbar from a pdf document I dynamically display on a page on my website to discourage printing and downloading of the document from the website. 请指导我如何从我动态显示在网站页面上的pdf文档中删除pdf工具栏,以阻止从网站打印和下载该文档。
On web.php route page, I have the following route 在web.php路由页面上,我有以下路由
Route::get('showresource/{id}','ResourceController@show');
Which returns the file and is then displayed in the following blade page 它返回文件,然后显示在以下刀片页面中
<object data="{{url('showresource/'.$current_lesson->resource_file)}}" type="{{$mime_type}}" height="600px" width="100%" id="resource-pdf" style=""></object>
I have added the following javascript to the page to no avail. 我将以下javascript添加到页面无济于事。
$(document).ready(function () {
$('#resource-pdf').contents().find('#toolbar').css('display','none');
});
This does not seem to be working. 这似乎不起作用。
I have also tried to use pdfjs but I don't know how to apply it to a laravel 5 project. 我也尝试过使用pdfjs,但我不知道如何将其应用于laravel 5项目。 I look forward to any support to solve this.
我期待任何支持来解决此问题。
Thank you 谢谢
In my case (chrome-based web browser) this bar is a <viewer-pdf-toolbar>
HTML tag. 在我的情况下(基于Chrome的网络浏览器),该栏是
<viewer-pdf-toolbar>
HTML标记。 If you add to your css file or between <style>
tag this code 如果添加到CSS文件中或
<style>
标签之间,则此代码
viewer-pdf-toolbar {
display: none !important;
}
The bar will disappear. 该条将消失。 Don't do this by inline method because this tag is often overwritten by web browser.
不要通过内联方法执行此操作,因为此标记通常会被Web浏览器覆盖。 My way is tested and works perfect.
我的方法已经过测试,可以完美工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.