title: encrypting dompdf while opening
body: <p>i am encrypting my pdf but when i open it and enters the password it always says wrong error this is my code:</p>
  
  <pre><code>    global $_dompdf_show_warnings;
      global $_dompdf_debug;
      global $_DOMPDF_DEBUG_TYPES;
  
      $outfile = $id . '_qr_codes.pdf';
      $save_file = TRUE; // Save the file or not
  
      $buff = $this-&gt;qr_generate_pdf($id);
      //echo $buff; die;
      $dompdf = new DOMPDF();
  
      $dompdf-&gt;load_html($buff);
      if (isset($base_path)) {
          $dompdf-&gt;set_base_path($base_path);
      }
      $dompdf-&gt;render(); 
          $dompdf-&gt;get_canvas()-&gt;get_cpdf()-&gt;setEncryption('admin','ownerpass');
  
      if ($_dompdf_show_warnings) {
          global $_dompdf_warnings;
          foreach ($_dompdf_warnings as $msg) {
              echo $msg . "\n";
          }
          echo $dompdf-&gt;get_canvas()-&gt;get_cpdf()-&gt;messages;
          flush();
      }
        if ($save_file) {
          // if ( !is_writable($outfile) )
          // throw new DOMPDF_Exception("'$outfile' is not writable.");
  
          if (strtolower(DOMPDF_PDF_BACKEND) == "gd") {
              $outfile = str_replace(".pdf", ".png", $outfile);
          }
  
          list($proto, $host, $path, $file) = explode_url($outfile);
  
          if ($proto != "") // i.e. not file://
              $outfile = $file; // just save it locally, FIXME? could save it like wget: ./host/basepath/file
          //$outfile = dompdf_realpath($outfile);
          // if ( strpos($outfile, DOMPDF_CHROOT) !== 0 )
          // throw new DOMPDF_Exception("Permission denied.");
          file_put_contents($outfile, $dompdf-&gt;output(array("compress" =&gt; 0)));
      }
  
      if (!headers_sent())
          $dompdf-&gt;stream($outfile);
  }
  </code></pre>
  
  <p>when i enter the password 'ownerpass' in the downloaded pdf it throughs an error-> The Password is incorrect. Please make sure that capslock is not on by mistake,and try again.
  Thanks in advance</p>