简体   繁体   English

Typo3 Neos HTML转PDF

[英]Typo3 Neos HTML to PDF

I got problem when trying to create PDF file. 尝试创建PDF文件时出现问题。 Is there any other way to create pdf beside using FPDF? 除了使用FPDF之外,还有其他方法可以创建pdf吗? Because i'm struggling to include the class from fpdf into the backend. 因为我正在努力将fpdf中的类包含到后端中。

require_once(dirname(__FILE__).'/fpdf17/fpdf.php');
$pdf = new \Backend\Controller\fpdf17\FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,'Hello World!');
$pdf->Output();

But this code is not working, got problem with the require. 但是此代码不起作用,需求出现问题。

And i also try with TCPDF but it's not working. 我也尝试使用TCPDF,但是它不起作用。

The error for TCPDF is i'm stuck on TCPDF Examples page. TCPDF的错误是我停留在“ TCPDF示例”页面上。

This is the code https://gist.github.com/anonymous/d346ff2d6fb9d1852925 这是代码https://gist.github.com/anonymous/d346ff2d6fb9d1852925

Anyhelp would be much appreciated, thanks! 任何帮助将不胜感激,谢谢!

Got the answer 得到了答案

when trying to call the TCPDF class : 尝试调用TCPDF类时:

use this : 用这个 :

$pdf = new \\TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $ pdf =新\\ TCPDF(PDF_PAGE_ORIENTATION,PDF_UNIT,PDF_PAGE_FORMAT,是,'UTF-8',是);

instead of : 代替 :

$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $ pdf =新的TCPDF(PDF_PAGE_ORIENTATION,PDF_UNIT,PDF_PAGE_FORMAT,是,'UTF-8',否);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM