Sha256: e4527fad7f405f1412573c3ed6f676034aa831fc34ace1b589c33263ef525671

Contents?: true

Size: 662 Bytes

Versions: 20

Compression:

Stored size: 662 Bytes

Contents

#
# Render a Letter to PDF. Try and get it from the cachefirst
# Lean on Letters::HTMLRenderer which already renders the letter to html via
# LetterPresenter#content.
#
module Renalware
  module Letters
    class PdfRenderer
      OPTIONS = {
        page_size: "A4",
        footer: {
          font_size: 8,
          right: "Page [page] of [topage]"
        }
      }.freeze

      def self.call(letter)
        unless letter.respond_to?(:to_html)
          letter = LetterPresenterFactory.new(letter)
        end
        PdfLetterCache.fetch(letter) do
          WickedPdf.new.pdf_from_string(letter.to_html, OPTIONS)
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
renalware-core-2.0.0.pre.rc13 app/models/renalware/letters/pdf_renderer.rb
renalware-core-2.0.0.pre.rc11 app/models/renalware/letters/pdf_renderer.rb
renalware-core-2.0.0.pre.rc10 app/models/renalware/letters/pdf_renderer.rb
renalware-core-2.0.0.pre.rc9 app/models/renalware/letters/pdf_renderer.rb
renalware-core-2.0.0.pre.rc8 app/models/renalware/letters/pdf_renderer.rb
renalware-core-2.0.0.pre.rc7 app/models/renalware/letters/pdf_renderer.rb
renalware-core-2.0.0.pre.rc6 app/models/renalware/letters/pdf_renderer.rb
renalware-core-2.0.0.pre.rc5 app/models/renalware/letters/pdf_renderer.rb
renalware-core-2.0.0.pre.rc4 app/models/renalware/letters/pdf_renderer.rb
renalware-core-2.0.0.pre.rc3 app/models/renalware/letters/pdf_renderer.rb
renalware-core-2.0.0.pre.rc1 app/models/renalware/letters/pdf_renderer.rb
renalware-core-2.0.0.pre.beta12 app/models/renalware/letters/pdf_renderer.rb
renalware-core-2.0.0.pre.beta11 app/models/renalware/letters/pdf_renderer.rb
renalware-core-2.0.0.pre.beta10 app/models/renalware/letters/pdf_renderer.rb
renalware-core-2.0.0.pre.beta9 app/models/renalware/letters/pdf_renderer.rb
renalware-core-2.0.0.pre.beta8 app/models/renalware/letters/pdf_renderer.rb
renalware-core-2.0.0.pre.beta7 app/models/renalware/letters/pdf_renderer.rb
renalware-core-2.0.0.pre.beta6 app/models/renalware/letters/pdf_renderer.rb
renalware-core-2.0.0.pre.beta5 app/models/renalware/letters/pdf_renderer.rb
renalware-core-2.0.0.pre.beta4 app/models/renalware/letters/pdf_renderer.rb