나는 사용자가 pdf [in code]로 보고서를 작성해야하는 웹 사이트를 가지고 있습니다. 다음 코드를 시도했는데 일부 특수 문자가 표시됩니다.이 문제를 해결할 수 있도록 도와주세요.PHP를 사용하여 데이터를 PDF로 인쇄
<?php
require('fpdf.php');
//create a FPDF object
$pdf=new FPDF();
//set document properties
$pdf->SetAuthor('Lana Kovacevic');
$pdf->SetTitle('FPDF tutorial');
//set font for the entire document
$pdf->SetFont('Helvetica','B',20);
$pdf->SetTextColor(50,60,100);
//set up a page
$pdf->AddPage('P');
$pdf->SetDisplayMode(real,'default');
//insert an image and make it a link
$pdf->Image('logo.png',10,20,33,0,' ','http://www.fpdf.org/');
//display the title with a border around it
$pdf->SetXY(50,20);
$pdf->SetDrawColor(50,60,100);
$pdf->Cell(100,10,'FPDF Tutorial',1,0,'C',0);
//Set x and y position for the main text, reduce font size and write content
$pdf->SetXY (10,50);
$pdf->SetFontSize(10);
$pdf->Write(5,'Congratulations! You have generated a PDF.');
//Output the document
$pdf->Output('example1.pdf','I');
?>
제가 g endstream endobj 1 0 OBJ <> endobj 5 0 OBJ <> endobj 2 0 OBJ < </ProcSet [/ PDF/텍스트/ImageB/ImageC/ImageI]/폰트 아래와 같은 결과를 얻었다 < </F1 5 0 R >>/XObject < < >> >> endobj 6 0 obj < </제작자 (FPDF 자습서)/작성자 (Lana Kovacevic)/CreationDate (D : 20100215182640) >> endobj 7 0 obj < </유형/카탈로그/페이지 1 0 R/OpenAction [3 0 R/FitH null]/PageLayout/OneColumn >> endobj xref 0 8 0000000000 65535 f 0000000407 00000 n 000 0000595 00000 N 0000000204 00000 N 0000000282 00000 N 0000000494 00000 N 0000000699 00000 N 0000000822 00000 N 트레일러 < </크기 8/루트 7 0 R/정보 6 0 R >> startxref 그냥 필요한 대부분의 경우 925 %% EOF
안녕하세요. 문제에 대한 자세한 설명을 제공하십시오. 예를 들어 어떤 특수 문자가 출력되는지 보여 주십시오. –
네,'content-type' 헤더를 추가해야 할 것 같습니다. Cryo의 대답은 아래를 참조하십시오. –