印刷大虾生成pdf

时间:2012-03-19 12:40:56

标签: ruby-on-rails gem prawn

将prawn gem用于ruby-on-rails网页,是否可以将打印请求发送到打印机设备以打印我用prawn生成的pdf页面?

1 个答案:

答案 0 :(得分:3)

您似乎希望使用prawn-print

# Open print dialog, but don't autoprint.
pdf = Prawn::Document.new
pdf.text "I installed Adobe Reader and all I got was this lousy printout."
pdf.print

# Autoprint it on the default printer, when opened.
pdf = Prawn::Document.new
pdf.text "Help! I am trapped in a PDF factory!"
pdf.autoprint

# Autoprint it on a printer where the name includes "LaserJet".
pdf = Prawn::Document.new
pdf.text "Help! I am trapped in a PDF factory!"
pdf.autoprint "LaserJet"