Shrimp - Links inside table cells

I am trying to create pdf files using shrimp. Inside my PDF template, I have tables with cells. In one of these cells I have an email address:

cell_email = pdf.make_cell(:content => booking.user_email, :border_width => 0) 

I want to make an email for a link to a mailto link. I know that I can bind this way:

 pdf.formatted_text([{:text => booking.user_email, :link => "mailto: #{booking.user_email}"}]) 

However, combining these two lines (providing formatted text as content) does not work:

 cell_email = pdf.make_cell(:content => pdf.formatted_text([{:text => booking.user_email, :link => "mailto: #{booking.user_email}"}]), :border_width => 0) 

Any ideas how I can solve this problem (create an email link inside a table cell)?

With respect and gratitude!

+4
source share
1 answer

You can specify inline_format for the cell and create the link yourself:

 cell_email = pdf.make_cell( :content => "<link href='mailto:#{booking.user_email}'>#{booking.user_email}</link>", :inline_format => true ) 

You can also specify inline_format for the entire table:

 table data, :cell_style => { :inline_format => true } 

The inline_format shrimp supports <b> , <i> , <u> , <strikethrough> , <sub> , <sup> , <font> , <color> and <link> .

+7
source

All Articles