tp5使用TCPD扩展将html转pdf,保存pdf文件报错:fpen():remotehostfileaccessnotsupported,file://./parame.pdfUseTCPDtogeneratehtmlfileProcess1.下载TCPD扩展工程和目录接下来执行composerrequiretecnickcom/tcpdf2。控制器测试代码publicfunctionpdf(){$pdf=newTCPDF(PDF_PAGE_ORIENTATION,PDF_UNIT,PDF_PAGE_FORMAT,true,'UTF-8',false);$pdf->SetCreator(PDF_CREATOR);$pdf->SetAuthor('NicolaAsuni');$pdf->SetTitle('TCPDF示例001');$pdf->SetSubject('TCPDF教程');$pdf->SetKeywords('TCPDF,PDF,example,test,guide');$pdf->SetHeaderData(PDF_HEADER_LOGO,PDF_HEADER_LOGO_WIDTH,PDF_HEADER_TITLE.'001',PDF_HEADER_STRING,array(0,64,255),array(0,64,128));$pdf->setFooterData(array(0,64,0),array(0,64,128));$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN,'',PDF_FONT_SIZE_MAIN));$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA,'',PDF_FONT_SIZE_DATA));$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);$pdf->SetMargins(PDF_MARGIN_LEFT,PDF_MARGIN_TOP,PDF_MARGIN_RIGHT);$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);$pdf->SetAutoPageBreak(TRUE,PDF_MARGIN_BOTTOM);$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);if(@file_exists(dirname(__FILE__).'/lang/eng.php')){require_once(dirname(__FILE__).'/lang/eng.php');$pdf->setLanguageArray($l);}$pdf->setFontSubsetting(true);$pdf->SetFont('dejavusans','',8,'',true);$pdf->AddPage();$pdf->setTextShadow(array('enabled'=>true,'depth_w'=>0.2,'depth_h'=>0.2,'color'=>array(196,196,196),'opacity'=>1,'blend_mode'=>'正常'));$html=<< 此文本使用writeHTMLCell()方法打印,但您也可以使用:Multicell()、writeHTML()、Write()、Cell()和Text()。 请查看源代码文档和其他示例以获取更多信息。
