2014-01-30 86 views
-1

我正在使用pdfcrowd将php文件转换为pdf,但它转换空白pdf。可能是什么问题?做pdfcrowd转换php文件?pdfcrowd转换器将php文件转换为空白pdf

代码是在这里

<?php 
    require 'pdfcrowd.php'; 

try 
{ 

    $client = new Pdfcrowd("nabinashahi", "2ef55554fe4c2d23b52b8e080cac867g");// create an API client instance 


    // $pdf = $client->convertURI('http://www.google.com/'); 
    $pdf = $client->convertFile("C:/xampp/htdocs/pdf/page.php");// convert a web page and store the generated PDF into a $pdf variable 

    // set HTTP response headers 
    header("Content-Type: application/pdf"); 
    header("Cache-Control: no-cache"); 
    header("Accept-Ranges: none"); 
    header("Content-Disposition: attachment; filename=\"google_com.pdf\""); 


    echo $pdf;// send the generated PDF 
} 
catch(PdfcrowdException $why) 
{ 
    echo "Pdfcrowd Error: " . $why; 
} 
?> 

回答

0

我认为,问题是,你是不是把由你的PHP文件生成的输出,但实际的PHP文件本身。 pdfCrowd能够将HTML转换为PDF - 我不认为他们处理的PHP源代码很好,我不认为这就是你想要做的:-)