Ruby で PDF を出力する CGI
pdffile のパスにある PDF を読みつつ吐き出す CGI のサンプル
#!/usr/bin/env ruby pdffile = "sample.pdf" print "Content-Type:application/pdf\r\n" print "Content-Length: #{File.size(pdffile)}\r\n" print "\r\n" open(pdffile, "rb") { |f| while buf = f.gets do print buf end }