0
我使用API来生成PDF文档。在此API文档,我有:如何使用API生成PDF文档?
http://...../view_awb.php?user=nume_utilizator&parola=123456&awb=CGS12345678A
If success, the view_awb.php file will return a PDF document
下一个,我有这些代码:
require "../dbcommon2.php";
$url = "http://webexpress.cargus.ro/custom_print/shipment_import/view_awb.php?user=canai_test&parola=test&awb=TSD21185178T";
$pdf = file_get_contents($url, false);
require_once("../../dompdf/dompdf_config.inc.php");
$dompdf = new DOMPDF();
$dompdf->load_html($pdf);
$dompdf->render();
$dompdf->stream("sample.pdf");
一切看起来正常,但是当我打开PDF文件,我只看到
%PDF-1.3 3 0 obj > endobj 4 0 obj > stream xY[ sÚ8¾ï¯Ðe{UgÙ¹£tèd!KHg/:³ãñ.`Öì7ýõß«Æ6HM;M¤WÞãG¡oýûáHL"ð¥D¦é4Á
在哪里问题是什么?我怎样才能正确生成pdf文件? 我使用Adobe Reader打开pdf文件sample.pdf
实际上,它看起来像PDF,你是什么意思 “我开” 呢?你用记事本打开它? – Andrey
由Adobe Reader打开pdf文件sample.pdf –
您是否将内容类型设置为'application/pdf'? –