Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

347
Views
Unable to download pdf in html2pdf

I am trying to download pdf from html2pdf. Download dialog box doesn't appear and it gives error

Some data has already been output, can't send PDF file

I am trying to fetch the data from database and convert it into pdf downloadable. Here is the code

<?php   
    $content = '<html><body style=" background-color:#edeff0;
    margin:0px;padding:0px;">';
    $content .= '<p>kjhj</p>'; 
    $content .= '</body></html>';
    require_once('html2pdf/html2pdf.class.php');
    $html2pdf = new HTML2PDF('P','A4','fr');
    $html2pdf->WriteHTML($content);
    $separator = md5(time());
    $eol = PHP_EOL;
    $filename = "receipt.pdf";
    $pdfdoc = $html2pdf->Output($filename, 'D');
    header("Content-Disposition: attachment; filename=receipt.pdf");
 ?>
over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!