ruby on rails - Prawn PDF and empty database cells? -
I am using PDF prone to create a PDF file when I fly into my Rail application.
I recently know that if there is nothing to display then I think that & lt; Li & gt;
I can hide rows. For some time I was thinking something!
Is it possible to do this in shrimp? Hide a row if it's empty?
I currently have the following:
contact name address line 1 address line 2 address line 3 postcode phone number fax number
If, for example, the user has just entered the contact name and postcode, there would be a significant difference where address line 1, 2 and 3 should be.
If I can ignore these lines because they are empty and display it in this form:
the zip code of the contact name
Use incorrect fields to ensure that this will adjust my PDF and save the user looks correct in PDF.
This code of my shrimp looks up:
pdf.text_box "client" ,: size = & gt; 9, = at & gt; [50,673] pdf.text_box "#{@kase.company.companyname}" ,: Size = & gt; 9, = at & gt; [100,673] pdf.text_box "#{@kase.company.companyaddressline1}" ,: Size = & gt; 9, = at & gt; [100,665] pdf.text_box "#{@kase.company.companyaddressline2}" ,: Size = & gt; 9, = at & gt; [100,655] pdf.text_box "#{@kase.company.companyaddressline3}" ,: Size = & gt; 9, = at & gt; [100,645] pdf.text_box "#{@kase.company.companyaddresscity}" ,: Size = & gt; 9, = at & gt; [100,635] pdf.text_box "#{@kase.company.companyaddresspostcode}" ,: Size = & gt; 9, = at & gt; [100,625]
I searched the Prone Google User Group site, but I can not find what I need.
Thanks in advance!
Danny
PDF bounding box (exits from shameless shrimp documentation). Pdf.bounding_box ([100,400] ,: width => 400) pdf.text ("this box has height # {pdf.bounds.height}") pdf.text ('This is some text') PDF.Text ('this is some more text') PDF.Text ('and a little more at the end') PDF.Text ("now the height of this box # {pdf.bound.heit} Is ") End
Can be easily modified to print if the attribute is available.
Comments
Post a Comment