Jump to content
TNG Community
ca_drm1n

Problem using PDF generator - CMS related?

Recommended Posts

ca_drm1n

I posted this question the TNGUSERS2 mailgroup, and Darrin believes it is specific to the behavior of the e107 header. Anyone have any ideas on how I would proceed down the path Darrin suggests?

My original question:

I run my TNG site (v7.02) within e107, a content mgmt system (CMS). So far, all seems to work well with the exception of the PDF link found on several the pages (getperson.php, pedigree.php and descend.php). I have experienced the same behavior in IE6, IE7, and FF2, trying both Adobe Reader 8 and 9.

Specifically, clicking the link opens a second small window, titled PDF Generator, with configurable font and page setup options, and a Create Chart button. If I click the button, another browser window opens (rpt_ind.php, rpt_pedigree.php, or rpt_descend.php), displaying the menus and header from my content management system, but in the content area, where the TNG content would normally be displayed, the only thing there is:

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

Is this a TNG issue, or (more likely) due to running TNG within the CMS framework?

Any idea how I would fix it (or, in the meantime, not display the PDF link on the page)?

Darrin's reply:

Thanks. The error message you're getting seems to indicate that something else (the CMS header?) was already sent to the buffer before the PDF output could even begin. If it is the CMS header, then you'll need to tell your CMS that the rpt_ind.php, rpt_pedigree.php and rpt_descend.php scripts should be allowed to execute without the CMS header being tacked on to the beginning of the output. I'm not an e107 expert, so hopefully there's someone else out there with enough knowledge to tell you how to do that.

Darrin

So I am turning to the e107 experts here: how do I get the pdf creator to call the TNG content in its own window (no e107 header or side menus) so that it will render the PDF correctly?

TIA,

- Al

Share this post


Link to post
Share on other sites
tomk

I'm having a similar problem with

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

It happens in only one of my two subdirectories. I've had the problem before without resolve except for reinstalling TNG. Last week I switched hosting providers (not for this reason).

As part of changeover I installed TNG fresh in each of the subdirectories - one is a public tree and the other a private tree requiring login. The public tree one worked initially, but after a new GEDCOM was imported I started to see the FPDF error - regardless of browser, or what TNG page I click PDF on. The private tree is connected to a CMS (Joomla) via a bridge and that one works fine.

I've tried replacing key TNG files, but the public tree still has this problem. While it is aggravating, it is not critical to me because my real installation under Joomla is working fine. I have not yet fixed the problem on the public tree. PM me if you want details of installation.

TomK

______

Update: I reinstalled another version and then tried to replicate when the problem started. I think it may have been related to changes made to genlib.php to modify some of the dropdown menus. Tried restoring those but continued to have problems. At one point during the testing I got the following error:

"Warning: Cannot modify header information - headers already sent by (output started.... genlib.php:1634) in .../fpdf.php on line 1022

FPDF error: Some data has already been output to browser, can't send PDF file."

That occurred after I uploaded the modified genlib.php file to the new test site. After that more problems, so I just deleted both sites and recreated public site. Problem gone.. Note, I only recreated the TNG files, and pointed them back to the original MySQL database.

TomK

Share this post


Link to post
Share on other sites
ca_drm1n

I'm having a similar problem with

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

It happens in only one of my two subdirectories. I've had the problem before without resolve except for reinstalling TNG. Last week I switched hosting providers (not for this reason).

As part of changeover I installed TNG fresh in each of the subdirectories - one is a public tree and the other a private tree requiring login. The public tree one worked initially, but after a new GEDCOM was imported I started to see the FPDF error - regardless of browser, or what TNG page I click PDF on. The private tree is connected to a CMS (Joomla) via a bridge and that one works fine.

I've tried replacing key TNG files, but the public tree still has this problem. While it is aggravating, it is not critical to me because my real installation under Joomla is working fine. I have not yet fixed the problem on the public tree. PM me if you want details of installation.

TomK

______

Update: I reinstalled another version and then tried to replicate when the problem started. I think it may have been related to changes made to genlib.php to modify some of the dropdown menus. Tried restoring those but continued to have problems. At one point during the testing I got the following error:

"Warning: Cannot modify header information - headers already sent by (output started.... genlib.php:1634) in .../fpdf.php on line 1022

FPDF error: Some data has already been output to browser, can't send PDF file."

That occurred after I uploaded the modified genlib.php file to the new test site. After that more problems, so I just deleted both sites and recreated public site. Problem gone.. Note, I only recreated the TNG files, and pointed them back to the original MySQL database.

TomK

Tom,

Bret Rumsey provided this info:

Al,

The way the PDF creation works is:

- The pdfform.php page is called via javascript and produces a javascript window (created via AJAX) where you select your PDF options.

- The pdfform.php creates a new browser window which calls rpt_*.php (depending on which report you are creating). The rpt_*.php pages only generate PDF data, so any text that is output before the PDF is printed will produce an error.

Looking at your webpage it is clear that it is generating the top and left frames for each request (even the javascript windows). There must be someway to tell e107 that it shouldn't do this for pdfform.php and rpt_*.php.

I have also found some information on the e107 forums (here and here) that suggest this problem may be theme-dependent, and also a lot of talk that suggests it is related to an extra space or line feed in the php file either before the <php or after the ?> at the end. In e107, I have gone through and modified most of the usual culprits (and did find some extra line feeds), but it still has not resolved for me. If I can find a viable solution, I will post it back here...

- Al

Share this post


Link to post
Share on other sites
theKiwi

I believe that what Bret is saying is that for these PDF forms, you have to display them WITHOUT the Clan Moffat Society interfering with them - ie processing them at all.

So you need to tell e107 not to try and put a header or menu or do anything at all with the files that are involved in displaying the PDF files.

Roger

Share this post


Link to post
Share on other sites
ca_drm1n

I believe that what Bret is saying is that for these PDF forms, you have to display them WITHOUT the Clan Moffat Society interfering with them - ie processing them at all.

So you need to tell e107 not to try and put a header or menu or do anything at all with the files that are involved in displaying the PDF files.

Roger

Roger, understand, that is my next research project on the e107 forums - to find out how to suppress the header and menus for a new window being opened. What I find odd is the folks on the e107 forums mentioned having the same error (unrelated to a TNG install) and that after removing the extra spaces from certain php files, they no longer had the problem (i.e., they didn't mention taking extra steps to suppress the header/menu).

In any case, I think the easiest fix for me is shaping up to be as you note, somehow keeping the newly opened javascript window and rpt_* page from including the header and menu portions of the e107 wrapper...

If you click on the PDF link on this page at my site, you'll note that the header and menu also show up in the AJAX-created javascript window (a new browser window, I understand, but seeing them in the javascript popup was a surprise).

- Al

Share this post


Link to post
Share on other sites
ca_drm1n

Roger, understand, that is my next research project on the e107 forums - to find out how to suppress the header and menus for a new window being opened. What I find odd is the folks on the e107 forums mentioned having the same error (unrelated to a TNG install) and that after removing the extra spaces from certain php files, they no longer had the problem (i.e., they didn't mention taking extra steps to suppress the header/menu).

In any case, I think the easiest fix for me is shaping up to be as you note, somehow keeping the newly opened javascript window and rpt_* page from including the header and menu portions of the e107 wrapper...

If you click on the PDF link on this page at my site, you'll note that the header and menu also show up in the AJAX-created javascript window (a new browser window, I understand, but seeing them in the javascript popup was a surprise).

- Al

Oh, giddyup! This thread may hold promise to do what I need... will try it and report back!

Share this post


Link to post
Share on other sites
ca_drm1n

Oh, giddyup! This thread may hold promise to do what I need... will try it and report back!

Well, good news and bad news. GOOD: I have now successfully suppressed the header and menus from displaying when rpt_ind.php is called. BAD: Still get the same error (FPDF error: Some data has already been output, can't send PDF file).

Things that make you go hmmmm...

Share this post


Link to post
Share on other sites
ca_drm1n

Well, good news and bad news. GOOD: I have now successfully suppressed the header and menus from displaying when rpt_ind.php is called. BAD: Still get the same error (FPDF error: Some data has already been output, can't send PDF file).

Things that make you go hmmmm...

Turns out the above solution was only treating the symptom... although the header and menus were being excluded, parts of the e107 wrapper were still being included, which was corrupting the pdf output and throwing the error. The solution required the addition of rpt_ind.php, rpt_pedigree.php, and rpt_descend.php to the exclusions list found within tngIL_begin.php, as follows:

code excerpt:

$_GET['tngprint']||

eregi("findpersonform.php", $_SERVER[php_SELF])||

eregi("rpt_ind.php", $_SERVER[php_SELF])||

eregi("rpt_pedigree.php", $_SERVER[php_SELF])||

eregi("rpt_descend.php", $_SERVER[php_SELF])||

eregi("findperson.php", $_SERVER[php_SELF])||

eregi("pedxml.php", $_SERVER[php_SELF])||

eregi("showmediaxml.php", $_SERVER[php_SELF])||

eregi("smallimage.php", $_SERVER[php_SELF])||

eregi("ea_match.php", $_SERVER[php_SELF])||

eregi("ea_submit.php", $_SERVER[php_SELF])||

eregi("fr_addmatch.php", $_SERVER[php_SELF])

Share this post


Link to post
Share on other sites
svoght

Here's an update to the modifications to tngIL_begin.php since we've discovered a few more files that need to be un-wrapped to work properly (and one for a plugin.)

Updated -- see below for current code

In addition to the changes listed above, this also adds pdfform.php (which displays the pop-up window where you define settings for pdf output), addbookmark.php, which is a pop-up window when you click the 'bookmark' link (unless you are using a modified bookmark system), and img_viewer.php, which is part of the Image Viewer mod from rumseyfamily.com. You can skip the img_viewer.php line if you're not planning to use that add-on, but it won't harm your setup to have it in there regardless.

Share this post


Link to post
Share on other sites
ca_drm1n

Here's an update to the modifications to tngIL_begin.php since we've discovered a few more files that need to be un-wrapped to work properly (and one for a plugin.)

$_GET['tngprint']||

eregi("findpersonform.php", $_SERVER[php_SELF])||

eregi("rpt_ind.php", $_SERVER[php_SELF])||

eregi("rpt_pedigree.php", $_SERVER[php_SELF])||

eregi("rpt_descend.php", $_SERVER[php_SELF])||

eregi("pdfform.php", $_SERVER[php_SELF])||

eregi("addbookmark.php", $_SERVER[php_SELF])

eregi("img_viewer.php", $_SERVER[php_SELF)||

eregi("findperson.php", $_SERVER[php_SELF])||

eregi("pedxml.php", $_SERVER[php_SELF])||

eregi("showmediaxml.php", $_SERVER[php_SELF])||

eregi("smallimage.php", $_SERVER[php_SELF])||

eregi("ea_match.php", $_SERVER[php_SELF])||

eregi("ea_submit.php", $_SERVER[php_SELF])||

eregi("fr_addmatch.php", $_SERVER[php_SELF])

In addition to the changes listed above, this also adds pdfform.php (which displays the pop-up window where you define settings for pdf output), addbookmark.php, which is a pop-up window when you click the 'bookmark' link (unless you are using a modified bookmark system), and img_viewer.php, which is part of the Image Viewer mod from rumseyfamily.com. You can skip the img_viewer.php line if you're not planning to use that add-on, but it won't harm your setup to have it in there regardless.

Steve,

Shouldn't there be a || after the addbookmark line as well?

- Al

Steve,

Shouldn't there be a || after the addbookmark line as well?

- Al

Oops, by the time I commented, he already fixed it. Please disregard my last remark, the list posted by Steve is correct.

Share this post


Link to post
Share on other sites
svoght

I've just discovered one more TNG php file that needs to be unwrapped to work properly -- gedcom.php

This is the script that generates a .GED file if you have that function enabled on your site, and if it's wrapped you get a mess of HTML instead of a proper GEDCOM file... so, add it to the list, which is now updated below (this is within tngIL_begin.php):

$_GET['tngprint']||

eregi("findpersonform.php", $_SERVER[php_SELF])||

eregi("rpt_ind.php", $_SERVER[php_SELF])||

eregi("rpt_pedigree.php", $_SERVER[php_SELF])||

eregi("rpt_descend.php", $_SERVER[php_SELF])||

eregi("pdfform.php", $_SERVER[php_SELF])||

eregi("addbookmark.php", $_SERVER[php_SELF])||

eregi("gedcom.php", $_SERVER[php_SELF])||

eregi("img_viewer.php", $_SERVER[php_SELF])||

eregi("findperson.php", $_SERVER[php_SELF])||

eregi("pedxml.php", $_SERVER[php_SELF])||

eregi("showmediaxml.php", $_SERVER[php_SELF])||

eregi("smallimage.php", $_SERVER[php_SELF])||

eregi("ea_match.php", $_SERVER[php_SELF])||

eregi("ea_submit.php", $_SERVER[php_SELF])||

eregi("fr_addmatch.php", $_SERVER[php_SELF])

Share this post


Link to post
Share on other sites
Mosha

My TNG version  8.1.3

Hosting IX Webhosting

Templates 5 and 8

Sites: www.apellidosnorestenses.org

         www.schroeder-cantu.net

Please help. I have this same problem in 2 different sites.   FPDF error: Some data has already been output, can't send PDF file and I am embarrassed to confess I haven't noticed this problem until today that a member pointed it to me.

The thing is my native language is Spanish although I understand regular English pretty well and on top of that I know nothing about coding so I do not quite understand the instructions given here. 

I do know how to edit the code and have filezilla which helps me open the files but will need more detailed instructions.

I have already added the utf8 fonts for pdf on one site but as I said, I get the above error.  

Please, please help

Best Regards, 

Mosha

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×