This is a discussion on Progress bar for PDF file and load it. within the PHP General forums, part of the PHP Programming Forums category; Hi all, I am creating a pdf file with FPDF. The data are queried from a database. For a large ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi all,
I am creating a pdf file with FPDF. The data are queried from a database. For a large pdf file, It might take upto 10 mins to finish. I want to have a progress bar to show the progress status. I tried to echo some word to the browser every little while. However, as the header of the result page is set to "content-type:application/pdf". I can't echo words at all. On the other hand, if I echo some word during the process and redirect the page to the pdf file, I keep getting the "Header Has Already Sent" error as the redirect mainly setting the header with location to somewhere after the output is sent. Finally, I think of a stupid method. I set the Header to "content-type:application/pdf" before the processing the result set from the database. Then after about each 100 records are processed, I will read a pre-created pdf file with a number on it and then flush() it to the browser. Actually, I use this method to keep the browser alive during the long process of creating the pdf file. Although the browser (including IE 6.0, Netscape 7.0, MozillaFirdBird...etc.) is kept alive, the pre-created pdf file is never shown. Therefore, the progress status is never shown! Please let me know is there any method to show the progress status before reading a PDF file to the browser. Thank You Very Much!~ Harry Yau |
|
|||
|
harry@grandford.com (Harry Yau) wrote in message news:<23b0453a.0402172147.9d11522@posting.google.c om>...
> Hi all, > > I am creating a pdf file with FPDF. The data are queried from a > database. For a large pdf file, It might take upto 10 mins to finish. > I want to have a progress bar to show the progress status. I tried to > echo some word to the browser every little while. However, as the > header of the result page is set to "content-type:application/pdf". I > can't echo words at all. > > On the other hand, if I echo some word during the process and > redirect the page to the pdf file, I keep getting the "Header Has > Already Sent" error as the redirect mainly setting the header with > location to somewhere after the output is sent. > > Finally, I think of a stupid method. I set the Header to > "content-type:application/pdf" before the processing the result set > from the database. Then after about each 100 records are processed, I > will read a pre-created pdf file with a number on it and then flush() > it to the browser. > > Actually, I use this method to keep the browser alive during the > long process of creating the pdf file. > > Although the browser (including IE 6.0, Netscape 7.0, > MozillaFirdBird...etc.) is kept alive, the pre-created pdf file is > never shown. Therefore, the progress status is never shown! > > Please let me know is there any method to show the progress status > before reading a PDF file to the browser. > > Thank You Very Much!~ > > Harry Yau Hi all, I think my real question is how could to make the browser show whatever it has received from point to point. As I know IE won't show data until it receive something like "End Of Document Character". How could I sent one signal to make the browser to really flush the data to the screen. Moreover, is it possible to send data after the "End Of Document Character" is sent? I hope I didn't make the problem even more un-clear! Thank You Very Much! Harry Yau |
|
|||
|
How about saving the pdf locally, and have your 'proper' php page display
a status bar? Then, when the file completes, send it from the storage on the server and erase it? Not sure of ANY of the specifics of this, but it's a method that might work. On 17 Feb 2004 21:47:22 -0800, Harry Yau <harry@grandford.com> wrote: > Hi all, > > I am creating a pdf file with FPDF. The data are queried from a > database. For a large pdf file, It might take upto 10 mins to finish. > I want to have a progress bar to show the progress status. I tried to > echo some word to the browser every little while. However, as the > header of the result page is set to "content-type:application/pdf". I > can't echo words at all. > > On the other hand, if I echo some word during the process and > redirect the page to the pdf file, I keep getting the "Header Has > Already Sent" error as the redirect mainly setting the header with > location to somewhere after the output is sent. > > Finally, I think of a stupid method. I set the Header to > "content-type:application/pdf" before the processing the result set > from the database. Then after about each 100 records are processed, I > will read a pre-created pdf file with a number on it and then flush() > it to the browser. > > Actually, I use this method to keep the browser alive during the > long process of creating the pdf file. > > Although the browser (including IE 6.0, Netscape 7.0, > MozillaFirdBird...etc.) is kept alive, the pre-created pdf file is > never shown. Therefore, the progress status is never shown! > > Please let me know is there any method to show the progress status > before reading a PDF file to the browser. > > Thank You Very Much!~ > > Harry Yau -- George Howell "I ride for the same reason dogs stick their head out ghowell@refundersrefuge.org of car windows" gmhowell@comcast.net |