Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RTF::Writer and printing

Status
Not open for further replies.

h011ywood

Programmer
Dec 1, 2003
55
US
Alright, so here's the problem.

I have a script that generates a report in HTML, whcih as we all know printing HTML isn't great, so I've added a button that when clicked will generate an RTF using RTF::Writer.

Because of the potential of High Volume of users accessing this report I'm attempting to use the 'new_to_string' initializer which will create the RTF as a string variable rather than create a document on the server and I would like to simply print the RTF.

I've added the following into the header of the HTML

<link rel=alternate media=print ref=report.asp?printReport=1>

which will regenerate the report in RTF

and at the end of the script I

print $rtf_string;

--------------------------------------------------------

With all this said, what I've been able to get working, is puttin the following into the HTTP header...

$Response->{ContentType} = "application/rtf";
$Response->AddHeader("Content-Disposition", "attachment; filename=report.rtf");

Which when you click the button, it prompts the user to save the rtf as "report.rtf" and it saves fine and can be open in Word as it should.

What doesn't work, is doing a 'window.print();' from my button, it gives an error saying:

"Internet Explorer cannot download report.rtf" blah blah blah



Thanks for any help you may give

H011ywood
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top