首页 > 解决方案 > Is there a way to disable copy function in embedded pdf html

问题描述

So I'm making a pdf page and I'm trying to make it so you can't copy the text inside the pdf.

Here's my code:

<?php

    $type = isset($_GET['type']) ? $_GET['type'] : '';
    $code = isset($_GET['code']) ? $_GET['code'] : '';

?>
<!DOCTYPE html>
<html>
    <head>
        <link rel="icon" href="../assets/images/icon/pup-icon.png" type="image/x-icon" />
        <link rel="shortcut icon" type="image/x-icon" href="../assets/images/icon/pup-icon.png" />
        <style type="text/css"></style>

        <title>Polytechnic University of the Philippines</title>
    </head>
    <body>
        <embed style="position:absolute; left: 0; top: 0;" width="100%" height="100%" src="../thesis/<?php echo $type; ?>/<?php echo $code; ?>.pdf" type="application/pdf">
    </body>
</html>

I also tried to put onmousedown="return false" onselectstart="return false" on the body but it doesn't seem to do anything.

标签: phphtmlpdf

解决方案


推荐阅读