Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/242.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/svn/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何清洁magento收割台_Php_Magento_Pdf - Fatal编程技术网

Php 如何清洁magento收割台

Php 如何清洁magento收割台,php,magento,pdf,Php,Magento,Pdf,我试图在模块中的magento视图中显示PDF 我使用html2fpdf.php,在普通的php页面中,除了一个magento phtml页面之外,一切都很好 我收到了:%PDF-1.3 3 0 obj endobj,还有更多 我认为这可能是magento标题的问题: <?php header_remove(); header('Content-type: application/pdf'); include_once ('htmlpdf/html2fpdf.php'); $pdff

我试图在模块中的magento视图中显示PDF

我使用html2fpdf.php,在普通的php页面中,除了一个magento phtml页面之外,一切都很好 我收到了:
%PDF-1.3 3 0 obj endobj
,还有更多

我认为这可能是magento标题的问题:

<?php 
header_remove();
header('Content-type: application/pdf'); 
include_once ('htmlpdf/html2fpdf.php');
$pdff = "  
<html>  
<head>  
<title>Titulo del archivo pdf</title>  
</head>  
<body>  
<p>Este es el texto del archivo pdf. Podemos incluir imagenes, enlaces, etc.</p>  
</body>  
</html>  
";  

$pdf = new html2fpdf();
$pdf->AddPage();
$pdf -> WriteHTML($pdff);
$pdf -> Output();
看一看@


可能意味着您的
header()
调用由于以前的输出而失败,浏览器将您的pdf视为text/plain或text/html。谢谢,我迷路了2天,jajashure谢谢,我会看看我是怎么做的这是我的第一篇帖子。
$this->getResponse()
     ->clearHeaders()
     ->setHeader('Content-Type', 'application/pdf')
     ->setBody(set pdf output here);