Welcome Guest, Not a member yet? Register   Sign In
dompdf 在页面输入乱码
#1

[eluser]DogWin[/eluser]
大家好,
我按照http://codeigniter.com/wiki/PDF_generation_using_dompdf/ 的例子
结果输出:
%PDF-1.3 1 0 obj << /Type /Catalog /Outlines 2 0 R /Pages 3 0 R /OpenAction 8 0 R >> endobj 2 0 obj << /Type /Outlines /Count 0 >> endobj 3 0 obj << /Type /Pages /Kids [6 0 R ] /Count 1 /Resources << /ProcSet 4 0 R /Font << /F1 9 0 R >> >> /MediaBox [0.000 0.000 612.000 792.000] >> endobj 4 0 obj [/PDF /Text ] endobj 5 0 obj << /Creator (dompdf) /CreationDate (D:20100722034235+00'00') /ModDate (D:20100722034235+00'00') >> endobj 6 0 obj << /Type /Page /Parent 3 0 R /Contents 7 0 R >> endobj 7 0 obj << /Filter /FlateDecode /Length 61 >> stream x��2�300P@&�ҹ�B��ls3K=##��}7CC#=��4 �0WM��,��� endstream endobj 8 0 obj [6 0 R /Fit] endobj 9 0 obj << /Type /Font /Subtype /Type1 /Name /F1 /BaseFont /Times-Roman /Encoding /WinAnsiEncoding >> endobj xref 0 10 0000000000 65535 f 0000000008 00000 n 0000000091 00000 n 0000000137 00000 n 0000000291 00000 n 0000000320 00000 n 0000000434 00000 n 0000000497 00000 n 0000000629 00000 n 0000000657 00000 n trailer << /Size 10 /Root 1 0 R /Info 5 0 R >> startxref 766 %%EOF
为什么会产生这种现象。
谢谢!
#2

[eluser]KingSkippus[/eluser]
Perhaps the Content-Type in your header is set incorrectly? In your controller, try adding the following line before outputting the PDF file:

Code:
header('Content-Type: application/pdf');

(I am sorry, I do not read Chinese, but thanks to Google, I got the gist of it. You are using http://codeigniter.com/wiki/PDF_generation_using_dompdf and it is generating the gibberish output you pasted above, and you want to know why it is doing that.)

翻译




Theme © iAndrew 2016 - Forum software by © MyBB