Discussion:
Generating pdf report and downloading
(too old to reply)
Lloyd
2008-10-22 00:22:18 UTC
Permalink
I'm generating custom reports outputing to a pdf format using pdf995. The report names are generated by the code based on the user and the report type. Immediately after the report generation, i'd like to make them available to down load or to view through a web page. With the following code, I've been trying to make it available from a web page:
wtitle = wtitle + ".pdf"
ocgi.fout.puts('<a href="rep/"' + wtitle + '">Selected Report</a>')

It appears that the title variable gets truncated to "rep/". Is it not possible to use a variable in an href statement? When a report title is hard coded in place of the title variable, testing it on localhost, an error 500 response page displays.

If any one has successfully generated reports to download or view, I'd appreciate some suggestons on this or any other methods that would accomplish this.

Thanks
Lloyd
Claus Mygind
2008-10-22 00:49:47 UTC
Permalink
Lloyd,

You might try escaping the / character. I think it would be like this \/
(back slash then forward slash).

No a closer look it seems like you are closing your " (double quotes) too
soon There should be one " before the "rep and then the one after the
wtitle + ' "

A better way and easier to read is to use the dBase [ ] (brackets) instead
for the outer wrapper.

ocgi.fout.puts( [<a href="rep/] + wtitle + [">Selected Report</a>] )

Then it is easier to see those internal wrappers.

Claus
Post by Lloyd
I'm generating custom reports outputing to a pdf format using pdf995. The
report names are generated by the code based on the user and the report
type. Immediately after the report generation, i'd like to make them
available to down load or to view through a web page. With the following
wtitle = wtitle + ".pdf"
ocgi.fout.puts('<a href="rep/"' + wtitle + '">Selected Report</a>')
It appears that the title variable gets truncated to "rep/". Is it not
possible to use a variable in an href statement? When a report title is
hard coded in place of the title variable, testing it on localhost, an
error 500 response page displays.
If any one has successfully generated reports to download or view, I'd
appreciate some suggestons on this or any other methods that would
accomplish this.
Thanks
Lloyd
Michael Nuwer
2008-10-22 19:43:02 UTC
Permalink
[Wed Oct 22 09:32:21 2008] [error] [client 127.0.0.1] C:/apache2_2/cgi-bin/rep/sue_col.pdf is not executable; ensure interpreted scripts have "#!" first line, referer: http://localhost/cgi-bin/fact_rep.exe
Sound to me that your cgi-bin folder is configured as a "script alias." If true,
Apache assumes that all files in that folder (and its subfolders) are executables.
Move the pdf files to something like C:/apache2_2/rep/sue_col.pdf, change your
code accordingly, and the downloads should work.
Lloyd
2008-10-22 15:30:08 UTC
Permalink
Claus, Thank You so much
That made the difference. The path is no longer truncated and includes the file name. But, I may have an apache configuration adjustment. Upon clicking the download link, the error 500 response page displays. The following two lines are appended into the apache error.log:
[Wed Oct 22 09:32:21 2008] [error] [client 127.0.0.1] C:/apache2_2/cgi-bin/rep/sue_col.pdf is not executable; ensure interpreted scripts have "#!" first line, referer: http://localhost/cgi-bin/fact_rep.exe
[Wed Oct 22 09:32:21 2008] [error] [client 127.0.0.1] (9)Bad file descriptor: don't know how to spawn child process: C:/apache2_2/cgi-bin/rep/sue_col.pdf, referer: http://localhost/cgi-bin/fact_rep.exe

Again, Thanks
Lloyd
Post by Claus Mygind
Lloyd,
You might try escaping the / character. I think it would be like this \/
(back slash then forward slash).
No a closer look it seems like you are closing your " (double quotes) too
soon There should be one " before the "rep and then the one after the
wtitle + ' "
A better way and easier to read is to use the dBase [ ] (brackets) instead
for the outer wrapper.
ocgi.fout.puts( [<a href="rep/] + wtitle + [">Selected Report</a>] )
Then it is easier to see those internal wrappers.
Claus
Post by Lloyd
I'm generating custom reports outputing to a pdf format using pdf995. The
report names are generated by the code based on the user and the report
type. Immediately after the report generation, i'd like to make them
available to down load or to view through a web page. With the following
wtitle = wtitle + ".pdf"
ocgi.fout.puts('<a href="rep/"' + wtitle + '">Selected Report</a>')
It appears that the title variable gets truncated to "rep/". Is it not
possible to use a variable in an href statement? When a report title is
hard coded in place of the title variable, testing it on localhost, an
error 500 response page displays.
If any one has successfully generated reports to download or view, I'd
appreciate some suggestons on this or any other methods that would
accomplish this.
Thanks
Lloyd
Loading...