I've installed the Printer-friendly Pages version 6.x-1.0-rc5 with tcpdf_php5 version 4.0.006 as described in the documentation on drupal 6.3. The example pages of tcpdf generates PDF-files corectly but when I try to create a PDF-File by clicking on the PDF-Create Link I get the following error: TCPDF error: Some data has already been output, can't send PDF file.

Please help.

Comments

Status:Active» Postponed (maintainer needs more info)

Hi,

I never saw that error. It's definitively a problem with TCPDF. Can you try dompdf instead?

João

I cannot use dompdf, because it doesn't support UTF8.

From what I have been able to find out, TCPDF shows that error when some kind of error was produced and logged before the actual PDF generation. Unfortunately, it can do so in more than one situation and I know of no way of finding out which was the actual error.

Without more info, I really cant' help you.

João

No further info received in 2 weeks, closing the issue.

Status:Postponed (maintainer needs more info)» Closed (fixed)

I have same problem.

same error here...
try this in print_pdf.pages.inc

in print_pdf.pages.inc
insert:

//Change To Avoid the PDF Error
  ob_end_clean();

just before
$pdf->Output($filename, $output_dest);

Status:Closed (fixed)» Needs review

Note that this doesn't really solve the problem.. TCPDF reported some kind of error/warning and the PDF will have problems..

However, I would like to know if you used the above line, and if so, what were the results.

João

It work fine for me. Add this line and I get the pdf file support UTF8.

Status:Needs review» Postponed (maintainer needs more info)

According to the documentation for ob_end_clean, it turns off the output buffer. That may have severe side-effects inside TCPDF. Can you try ob_clean instead and tell me if it also solves your problem?

João

Try ob_clean() also get correct pdf file. Thanks!

Status:Postponed (maintainer needs more info)» Fixed

Added ob_clean() to CVS.

João

ob_clean() works here also

Version:6.x-1.0-rc5» 6.x-1.5
Status:Fixed» Active

Hi
I have the latest 6.x-1.5 version of the Print module, and am experiencing the bug described above. I have attempted both suggested fixes of ob_end_clean() and ob_clean() but neither of them worked. The big difference in my configuration is that I'm using tcpdf_php4 on a PHP 4.3.11 system. I am able to successfully create the examples in tcpdf's 'examples' folder. Any ideas?

Edit: I installed the latest Dev cut of the Print module and I no longer receive this error. Now, when I try to retrieve a PDF for a 5 line article in UTF8, mty browser fails to download the entire 1.7 MB file. It usually gets to 1 MB or 1.5 MB and then fails. I'm suspecting that at this point it's a memory issue when trying to hold such a large file in memory at once. I will update if I figure anything else out.

Status:Active» Closed (fixed)

Two weeks without furhter info.. Closing the issue.

Version:6.x-1.10» 6.x-1.5
Status:Closed (fixed)» Fixed

I am experiencing the same problem. Using the latest print (6.x-1.5) tcpdf (4.6.025) and drupal (6.13).
My version of print already had the

// try to recover from any warning/error
  ob_clean();

And I also tried ob_end_clean() .

After reading the tcpdf forums I realized I had some whitespace and newliness at the end of my template.php file. Nothing should be outputted before pdf->output is called! Once I removed the fluff is everything worked fine.

Probably the solution for others still experiencing problem after the ob_clean fix.
(so I mark this as fixed, hope that's ok)

Automatically closed -- issue fixed for 2 weeks with no activity.

Version:6.x-1.5» 6.x-1.10

I'm using print (6.x-1.10) tcpdf (4.8.032) and drupal (6.15)
I found that if I edit code (ex. print_pdf.module or print_pdf.pages.inc) and save in UTF format, I'll get this error.
I must keep code in ANSI format, but I can use UTF for template file (ex. print.node-node_example.tpl.php) for thai language.

The ANSI save fixed this for me, too. Didn't try the ob_clean solution, so can't vouch for it.
- Cheers

I had similar error.
To resolve this I had to remove the closing php tags '>' in the end of file

I fixed it cleaning a whitespace line at the beggining of a custom module.

Version:6.x-1.5» 6.x-1.10
Status:Fixed» Closed (fixed)

This error means HTML header has been output before creating the PDF file.
Just remove any HTML headers and HTML tags in the PDF building pages and it works!

I added ob_start() before Output() to clear the PHP buffer how contains already 6 elements... even if I had no print or echo before Output().... This solved my problem but the use of ob_clean() didn't help

ob_start();
$tcpdf->output($filename, $output_dest);
ob_end_flush();

coloque require_once(dirname(__FILE__).'/html2pdf/html2pdf.class.php');
na primeira linha php como você faz com as sessões !