1

I'm creating pdf file using tcpdf. The PDF is created, but its contents are not allowed to copy.

Problem:

What should I do,so I will be able to copy the contents of pdf created. Is this achievable? Please guide me for the same. Thanks! Code:

 require_once('tcpdf_include.php');
 $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

 $pdf->SetProtection($permissions = array('print', 'modify', 'copy', 'annot-forms', 'fill-forms', 'extract', 'assemble', 'print-high'), '', null, 0, null);

 $pdf->SetCreator(PDF_CREATOR);


 $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, 'License Export Details');

 // set header and footer fonts
 $pdf->setHeaderFont(Array('helvetica', '', PDF_FONT_SIZE_MAIN));
 $pdf->setFooterFont(Array('helvetica', '', PDF_FONT_SIZE_DATA));

 // set default monospaced font
 $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);

 // set margins
 $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
 $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
 $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);

 // set auto page breaks

 $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);

 // set image scale factor

 $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);

 // set some language-dependent strings (optional)

 if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
require_once(dirname(__FILE__).'/lang/eng.php');
$pdf->setLanguageArray($l);
        }


 $pdf->SetFont('times', '', 16);

 // add a page

 $pdf->AddPage();

 //Write the html

 $html='================= Data==============';


//Convert the Html to a pdf document
 $pdf->writeHTML($html, true, false, true, false, '');

//Close and output PDF document
  $pdf->Output('Export_Details.pdf', 'D');
4

1 回答 1

3

i think you should delete these two lines

$pdf->SetProtection($permissions = array('print', 'modify', 'copy', 'annot-forms', 'fill-forms', 'extract', 'assemble', 'print-high'), '', null, 0, null);

$pdf->SetCreator(PDF_CREATOR);
于 2013-09-04T12:39:40.743 回答