1

I have trying this code

<?php
require ("fpdf/fpdf.php");
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,'Hello World!');
$pdf->Output();
?>

But I see the below errors:

Fatal error: Uncaught Exception: FPDF error: Some data has already been output, can't send PDF file (output started at /storage/ssd1/896/5392896/public_html/admin/case_pdf.php:1) in /storage/ssd1/896/5392896/public_html/admin/fpdf/fpdf.php:271 Stack trace: #0 /storage/ssd1/896/5392896/public_html/admin/fpdf/fpdf.php(1052): FPDF->Error('Some data has a...') #1 /storage/ssd1/896/5392896/public_html/admin/fpdf/fpdf.php(999): FPDF->_checkoutput() #2 /storage/ssd1/896/5392896/public_html/admin/case_pdf.php(28): FPDF->Output() #3 {main} thrown in /storage/ssd1/896/5392896/public_html/admin/fpdf/fpdf.php on line 271

Pankaj Makwana
  • 3,030
  • 6
  • 31
  • 47
A.S.Abir
  • 93
  • 7
  • check this link : https://stackoverflow.com/questions/9475686/fpdf-error-some-data-has-already-been-output-cant-send-pdf?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa – prakash tank May 01 '18 at 07:07

1 Answers1

0

try this before generating PDF

ob_end_clean();
Akshay Aggarwal
  • 237
  • 1
  • 12