Announcement

Collapse
No announcement yet.

TCPDF SetProtection problem

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • TCPDF SetProtection problem

    I followed the tutorial TCPDF example 16 to create a protected pdf document. The pdf was generated but the SetProtection properties did not seem to work. Did I miss anything? here is the example code.

    $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
    $pdf->SetProtection(array('print'), '', null, 0, null);
    $pdf->SetFont('times', '', 16);
    $pdf->Write(0, 'Can I copy?', '', 0, 'L', true, 0, false, false, 0);

    Thanks!

  • #2
    I think this is more related to ask on TCPDF community
    /Giuseppe

    Professional Scriptcase Services
    Some Customers opinions

    Comment


    • #3
      Thanks for your reply. It is a Scriptcase problem. For some reason, the SetProtection() method isn't called within the PDF Report. I fixed it by changing the grid class php source code. But I will have to change the code again everytime the report is regenerated.

      Comment


      • #4
        Originally posted by bonnielo View Post
        Thanks for your reply. It is a Scriptcase problem. For some reason, the SetProtection() method isn't called within the PDF Report. I fixed it by changing the grid class php source code. But I will have to change the code again everytime the report is regenerated.
        And what exactly did you has to change?
        /Giuseppe

        Professional Scriptcase Services
        Some Customers opinions

        Comment


        • #5
          xx_grid.class.php, look for line

          $pdf->SetProtection(array('copy'), '', null, 0, null);

          and change to

          $this->Pdf->SetProtection(array('copy'), '', null, 0, null);

          Comment


          • #6
            If you add one more parameter at the end of the class-instantiation for switching off PDFA-mode, then the setProtection-function does it's thing.

            As in:

            //TCPDF::__construct($orientation = ‘P’,$unit = ‘mm’,$format = ‘A4’,$unicode = true,$encoding = ‘UTF-8’,$diskcache = false,$pdfa = false );
            $pdf = new TCPDF('P', 'mm', 'A4', FALSE, 'ISO-8859-15', false, false);

            And then after printing the generated and secured PDF-document to a PDF-printer all protection set by setProtection is lost again...

            Comment

            Working...
            X