Prawn:Icon How can i set position of icon?

38 views
Skip to first unread message

Avada Kedavra

unread,
Oct 6, 2016, 4:28:42 AM10/6/16
to Prawn
I used 
text_box("#{@worker.email}", at: [400, 700], :inline_format => true)
but it's not work. Pls help me. Tks for any help 

Avada Kedavra

unread,
Oct 6, 2016, 4:33:06 AM10/6/16
to Prawn
Edit:

Vào 15:28:42 UTC+7 Thứ Năm, ngày 06 tháng 10 năm 2016, Avada Kedavra đã viết:
I used 
text_box(icon('fa-envelope'), at: [400, 700], :inline_format => true)
Message has been deleted

jdo...@ualberta.ca

unread,
Nov 2, 2016, 11:46:27 PM11/2/16
to Prawn
Sorry, I messed up my previous post.

Hi, I'm the author of Prawn::Icon!

I haven't been using Prawn myself recently, so I might be rusty.

You should be able to use a bounding box to position arbitrary elements:

Prawn::Document.generate('test.pdf') do |pdf|
  pdf
.bounding_box([400, 700], height: 50, width: 50) do
    pdf
.icon 'fa-envelope', valign: :center, align: :center
    pdf
.stroke_bounds # if you want to visualize the box
 
end
end


I hope this helps!
Reply all
Reply to author
Forward
0 new messages