This works for PDF format :
// PDF datastream is printed in $buffer
// after all has been printed
header("Content-type: application/pdf");
header("Content-Length: $len");
header("Content-Disposition: inline; filename="report.pdf");
print $buffer;
If you know the format of RTF files you can output this to $buffer and change content type to ??
not complete but maybe usefull.
Maybe you can develop a RTF lib like PDFLib ;-).
Jan