Sha256: 3935dbbcfd5bc7cd5a4008cfaee8fec8fad02d11d0cc527cdf0e27ee9e926f6b

Contents?: true

Size: 1.3 KB

Versions: 17

Compression:

Stored size: 1.3 KB

Contents

module Lipsiadmin
  module View
    module Helpers
      # This helper is necessary for when we generate some PDF
      # remember that basically pdf are standard html pages
      # and we use PD4ML for convert it in PDF. 
      # 
      # So for example is necessary have an header for all pdf page
      # and a footer.
      # 
      # Here you can find helpers for do that.
      # 
      module PdfHelper
        # Return the pd4ml header tag block
        def pdf_header(&block)
          html = <<-HTML
            <pd4ml:page.header>
              <div style="padding:0px 0px 100px 0px">
                #{capture(&block)}
              </div>
            </pd4ml:page.header>
          HTML
          concat(html)
        end
        
        # Return the pd4ml footer tag block
        def pdf_footer(&block)
          html = <<-HTML
            <pd4ml:page.footer>
              #{capture(&block) if block_given?}
              <div style="text-align:right;padding-top:10px">#{I18n.t("backend.general.page")} $[page] #{I18n.t("backend.general.of")} $[total]</div>
            </pd4ml:page.footer>
          HTML
          block_given? ? concat(html) : html
        end
        
        # Return the pd4ml page break tag
        def pdf_page_break
          "<pd4ml:page.break>"
        end
      end
    end
  end
end
      

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
lipsiadmin-5.1.6 lib/view/helpers/pdf_helper.rb
lipsiadmin-5.1.5 lib/view/helpers/pdf_helper.rb
lipsiadmin-5.1.4 lib/view/helpers/pdf_helper.rb
lipsiadmin-5.1.3 lib/view/helpers/pdf_helper.rb
lipsiadmin-5.1.2 lib/view/helpers/pdf_helper.rb
lipsiadmin-5.1.1 lib/view/helpers/pdf_helper.rb
lipsiadmin-5.1.0 lib/view/helpers/pdf_helper.rb
lipsiadmin-5.0.9 lib/view/helpers/pdf_helper.rb
lipsiadmin-5.0.8 lib/view/helpers/pdf_helper.rb
lipsiadmin-5.0.7 lib/view/helpers/pdf_helper.rb
lipsiadmin-5.0.6 lib/view/helpers/pdf_helper.rb
lipsiadmin-5.0.5 lib/view/helpers/pdf_helper.rb
lipsiadmin-5.0.4 lib/view/helpers/pdf_helper.rb
lipsiadmin-5.0.0 lib/view/helpers/pdf_helper.rb
lipsiadmin-5.0.1 lib/view/helpers/pdf_helper.rb
lipsiadmin-5.0.2 lib/view/helpers/pdf_helper.rb
lipsiadmin-5.0.3 lib/view/helpers/pdf_helper.rb