TCPDF ERROR Some data has already been output can t send PDF file

0 votes

I keep receiving this error when trying to add my own array into the code. Here is my array;

$array = array(); 
while (odbc_fetch_row($rs)) 
{ 
$array[] = odbc_result($rs,'Product Name'); 
} 
$test = print_r($array);

This code is before the $html variable and when it is set I just add the $test variable into the $html variable. The odbc connection works fine and the example works fine before I add any code but when I run the script I get this error;

Array ( [0] => Test1 [1] => Test2 ) TCPDF ERROR: Some data has already been output, can't send PDF file

And also, are there also more than 2 items included in the Array. Any ideas?

Feb 16, 2022 in Others by Soham
• 9,730 points
5,260 views

1 answer to this question.

0 votes

To answer your question, do add the function ob_end_clean(); before calling the Output function. It worked for me within a custom Wordpress function!

ob_end_clean(); $pdf->Output($pdf_name, 'I');

answered Feb 16, 2022 by Aditya
• 7,680 points

Related Questions In Others

0 votes
1 answer

Uipath(RPA) : read data from the PDF file and write to Excel file

is there any video recording to enable ...READ MORE

answered Jul 6, 2023 in Others by Santhosh

edited Mar 5, 2025 2,998 views
0 votes
1 answer

Spire When Pdf-ing an excel file it leaves some formulas as System.Object[][]

Since you tested the Excel file and ...READ MORE

answered Nov 25, 2022 in Others by narikkadan
• 86,360 points
1,602 views
0 votes
1 answer

How can I convert excel file to pdf using TCPDF?

PHPExcel can only read charts from Excel2007 ...READ MORE

answered Oct 21, 2022 in Others by narikkadan
• 86,360 points
3,012 views
+1 vote
2 answers

Scp Php files into server using gradle

Tru something like this: plugins { id ...READ MORE

answered Oct 11, 2018 in DevOps & Agile by lina
• 8,220 points
2,680 views
0 votes
1 answer

How do I create folder under an Amazon S3 bucket through PHP API?

Of Course, it is possible to create ...READ MORE

answered Apr 24, 2018 in AWS by anonymous
12,736 views
0 votes
1 answer

Failure uploading Image on AmazonS3 with PHP SDK

Try this, I took it out from ...READ MORE

answered May 4, 2018 in AWS by Cloud gunner
• 4,670 points
6,161 views
0 votes
1 answer

Web API Error - This request has been blocked; the content must be served over HTTPS

 If your web app is being hosted ...READ MORE

answered Feb 16, 2022 in Others by Aditya
• 7,680 points
37,836 views
0 votes
1 answer

Arduino IDE can't find ESP8266WiFi.h file

Customisation and selection of the correct card ...READ MORE

answered Feb 16, 2022 in Others by Aditya
• 7,680 points
10,965 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP