Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1014967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:19:53+00:00 2026-05-16T10:19:53+00:00

when I am trying to create the PDF file I got the following Error?

  • 0

when I am trying to create the PDF file I got the following Error?
I dont know why and I dont know how to fix it?
The Error is look like below
`

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\phpexample\createpdf.php:1) in C:\xampp\htdocs\phpexample\fpdf16\fpdf.php on line 1017`<br/>
`FPDF error: Some data has already been output, can't send PDF file`<br/>

My coding is like this

 <?php
 include_once('fpdf16/fpdf.php');$pdf=new FPDF();

$pdf->AddPage();
$reportdate = date('d-m-Y H:i:s');
$filename = $reportdate.'_report.pdf';
$pdf->SetFillColor(255,0,0);
$pdf->SetTextColor(255);
$pdf->SetDrawColor(128,0,0);
$pdf->SetLineWidth(.3);
$pdf->SetFont('Arial', 'B', 6);
// Header
$header=array('Member Card No','Full Name','Description', 'Start Date', 'Expiry Date', 'ramount', 'Address1', 'Address2');
$w = array(25, 35, 35, 15, 18, 15, 30, 30);
for($i=0;$i<count($header); $i++)
        $pdf->Cell($w[$i],7, $header[$i], 1, 0, 'L', true);

$pdf->Ln();

// Reset colour set for data 
$pdf->SetFillColor(224,235,255);
$pdf->SetTextColor(0);
$pdf->SetFont('courier','',7);
$fill=false;
$resultcount=8;
for($i=0;$i<$resultcount;$i++)
{
        $height =6;
        $pdf->Cell($w[0], '$height', 'CardNoishai', '1', '0', 'L', $fill);
        $pdf->Cell($w[1], '$height', 'Vinoth', '1', '0', 'L', $fill);
        $pdf->Cell($w[2], '$height', 'Sample PDF', '1', '0', 'L', $fill);
        $pdf->Cell($w[3], '$height', date('m-d-y'), '1', '0', 'L', $fill);
        $pdf->Cell($w[4], '$height', date('m-d-y'), '1', '0', 'L', $fill);
        $pdf->Cell($w[5], '$height', 'test', '1', '0', 'L', $fill);
        $pdf->Cell($w[5], '$height', 'test', '1', '0', 'L', $fill);
        $pdf->Cell($w[5], '$height', 'Add2', '1', '0', 'L', $fill);
        $pdf->Ln();
        $fill = !$fill;

}       
$pdf->Cell(array_sum($w),0,'','T');
$pdf->Output($filename, 'I');
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T10:19:54+00:00Added an answer on May 16, 2026 at 10:19 am

    Remove the blank space before the opening php tag.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a directory and copy a file (pdf) inside a Parallel.ForEach
I'm trying to create a method that will send a PDF file directly to
I am trying to create a PDF file using struts 2.Action class location is
I am trying to create a PDF file of current view. Can anyone please
I'm trying to generate a PDF file using AJAX call in Rails3. The following
I'm trying to do the following(in this order): Create a Rich Text Format file
Trying to create a PDF file based on an XML and a file using
I am trying to create a pdf file with iTextSharp. My attempt writes the
I'm trying to create a PDF file with a table of data.. But when
I am trying to create PDF file using DOM pdf and Codeigniter. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.