php generated pdf damaged file
===

I have a BIRT report that is being generated in PDF format. The report is then to be opened from the web browser. However, when the file is opened in Adobe Reader, I get the following error message:
>Adobe Reader could not open 'test.pdf' because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded).

When I run the exact same code (called from Schedule() and Search()) from the command line (the code is in PHP), I get the same report, but Adobe Reader is able to open it. Here is the code that I am using to read the file from the browser:

    <?php
      require "Search.php";
      require "Schedule.php";

      Schedule( $_POST['period'], mktime(23, 59, 59, $_POST['month'] + 1,
                                         $_POST['day'] + 1, $_POST['year']) );
  
      Search( $param1, $param2, $param3, $param4 );

      header('Content-type: application/pdf');
      header('Content-Disposition: attachment; filename="test.pdf"');
      readfile('/home/web/test.pdf');
    ?>

Schedule() and Search() have both been tested, and they should not be causing any problems. As I am still new to PHP, is there anything that I am missing that I just don't know about yet? Any help with this problem is greatly appreciated.

-rusty