允许复制使用 tcpdf 创建的 pdf 的内容 [英] Allow contents to be copied of pdf created using tcpdf

查看:34
本文介绍了允许复制使用 tcpdf 创建的 pdf 的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 tcpdf 创建 pdf 文件.已创建 PDF,但不允许复制其内容.

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

问题:

我该怎么做,这样我就可以复制创建的pdf的内容了.这是可以实现的吗?请指导我.谢谢!代码:

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

推荐答案

我觉得你应该删除这两行

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

这篇关于允许复制使用 tcpdf 创建的 pdf 的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆