2013-09-04 3 views
1

Я создаю pdf-файл, используя tcpdf. PDF создан, но его содержимое не разрешено копировать.Разрешить копирование содержимого из pdf, созданного с помощью tcpdf

Проблема:

Что я должен делать, так что я буду иметь возможность копировать содержимое PDF создан. Возможно ли это? Пожалуйста, направляйте меня за то же самое. Спасибо! Код:

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'); 

ответ

3

я думаю, вы должны удалить эти две строки

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

$pdf->SetCreator(PDF_CREATOR); 
+0

Я удалил $ pdf-> SetProtection(), и я получил ожидаемый результат. Благодаря! – Emma