如何在Ruby on Rails生成PDF文件中用大虾在一行中设置两种不同的字体样式?
我有以下代码:
pdf = Prawn::Document.new
pdf.text "Hello", :size => 22
pdf.text "wold", :size => 12
但此代码显示两行。 我希望将两个文本元素放在一行中,并具有相应的不同字体大小。
I have the following code:
pdf = Prawn::Document.new
pdf.text "Hello", :size => 22
pdf.text "wold", :size => 12
But this code displays two lines.
I want to have the two text elements in one single line with the different font sizes as corresponding.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不确定支持哪些标签,但这可能可以解决问题。
我在此处找到了这个答案。
I'm not sure which tags are supported, but this might do the trick.
I found this answer here.
这是一个旧的方法,但现在您可以这样使用 formatted_text 方法:
手册中的更多信息: http:// prawnpdf.org/manual.pdf
This is an old one, but now you can use the formatted_text method that way :
more info in the manual : http://prawnpdf.org/manual.pdf