使用 Prawn 在表中插入图像时出错
我正在与 Prawn 一起生成 pdf,我必须在表格的单元格中插入图像。
我的代码是这样的:
image = "path to file"
subject = [["FORMATIVE I "," SUMATIVE ","GRAPH"],
[formative_1,sumative, {:image => image}]
]
table subject
但是,我收到一条错误消息:
prawn/table/cell.rb:127:in `make': Content type not recognized: nil (ArgumentError)
我该如何解决这个问题?非常感谢任何帮助。
干杯!
I am working with Prawn to generate a pdf, I have to insert an image in a cell of a table.
My code is like this:
image = "path to file"
subject = [["FORMATIVE I "," SUMATIVE ","GRAPH"],
[formative_1,sumative, {:image => image}]
]
table subject
But, I get an error which says:
prawn/table/cell.rb:127:in `make': Content type not recognized: nil (ArgumentError)
How can I resolve this? Any help is greatly appreciated.
Cheers!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在当前版本的 Prawn
0.12.0
中,无法在Prawn::Table
中嵌入图像,但此功能似乎正在开发中,请参阅 此处。目前你必须编写自己的表格,例如In the current version of Prawn
0.12.0
it is not possible to embed images in aPrawn::Table
, but this feature seems to be under way, see here. At the moment you have to write your own table, something like0.12.0
版本中的 Prawn 无法在单元格中插入图像。查看更多信息。它适用于下一个版本1.0.0.rc1
。只需更改您的版本即可。你也可以使用trick的方式,但我建议你不要这样做。该手册可在此处获取。
作者对该功能的提交和解释。 这里
Prawn in version
0.12.0
doesn't give the possibility to insert image in a cell. Look at this for further information. It works on the next version1.0.0.rc1
. Just change your version. You can also use the tricky way, but I advise you not to do so.The manual is available here.
The commit and explanation for that feature from the author. Here