pdf kullanarak php gibi baskı verileri

3 Cevap

ben bu kullanıcı bir web sitesi [kod] pdf olarak rapor almaya ihtiyacı var, ben bazı özel karakterleri displayes aşağıdaki kod, fındık çalıştım, bana bu sorunu gidermek için yardımcı olun.

<?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'); 
?> 

i got the output as below g endstream endobj 1 0 obj <> endobj 5 0 obj <> endobj 2 0 obj << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI] /Font << /F1 5 0 R >> /XObject << >> >> endobj 6 0 obj << /Producer (FPDF 1.6) /Title (FPDF tutorial) /Author (Lana Kovacevic) /CreationDate (D:20100215182640) >> endobj 7 0 obj << /Type /Catalog /Pages 1 0 R /OpenAction [3 0 R /FitH null] /PageLayout /OneColumn >> endobj xref 0 8 0000000000 65535 f 0000000407 00000 n 0000000595 00000 n 0000000204 00000 n 0000000282 00000 n 0000000494 00000 n 0000000699 00000 n 0000000822 00000 n trailer << /Size 8 /Root 7 0 R /Info 6 0 R >> startxref 925 %%EOF

3 Cevap

Büyük olasılıkla sadece bu yüzden tarayıcı dosyayı işlemek için nasıl bilecek PDF olarak içerik türünü belirtmeniz gerekir.

header('Content-type: application/pdf');

before Eğer dediğimiz aramak emin olun $pdf->Output('example1.pdf','I');

Bu sorun aynı zamanda gönderilen Doğru tarayıcı bilgiye sahip ama an application that understands PDFs yüklü olmaması neden olabilir.

$pdf->Output('example1.pdf','I');

Dosya pdf kazandıracak. Eğer doğrudan tarayıcıda pdf göstermek istiyorsanız (veya açık indir iletişim, bu tarayıcı ve eklentileri bağlıdır), yapmanız gereken:

$pdf->Output();

Output(..., 'I') Senin için HTTP başlıklarını ele gerekir - PHP-CLI kullandığınız sürece.

FDPF::Output php_sapi_name not 'cli' hedef olduğunda, 'I' geri bağlıdır. Hala tampon yankıları, ancak uygun başlıklar belirtilmemiştir.

Eğer FPDF 1.6 kullanıyorsanız, ESP, çizgiler 1010-1027 bkz. 1014, ve fpdf.php.