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);
The original code is here. I'm using an example page to try it because I know the example page works fine.
http://www.tcpdf.org/examples/example_001.phps
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 there is also more than 2 items in the Array. Any ideas?
Solution. The first and most common solution, is to search on your code what is the line or code that is generating some output before TCPDF and remove it (mentioned methods as print_r, var_dump, echo etc).
You may see this error when generating your PDF catalog: TCPDF ERROR: Could not include font definition file: arialmt. The error means that the font (in this example arialmt) is missing in the modules configuration files. You will therefore need to add the font in the corresponding folder.
Add the function ob_end_clean(); before call the Output function. It worked for me within a custom Wordpress function!
ob_end_clean(); $pdf->Output($pdf_name, 'I');
Just use ob_start(); at the top of the page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With