Sha256: 0e0d6bb5ffecd545e60806697af25e4314010d547e3db5fe8ab024dedf6be0ec
Contents?: true
Size: 1.43 KB
Versions: 58
Compression:
Stored size: 1.43 KB
Contents
# frozen_string_literal: true require "collection_presenter" module Renalware module Letters module Printing # Renders a PDF for printing with interleaved address and letter pages for multiple recipients class DuplexInterleavedPdfRenderer # Note we can't support page numbers here as they would start on the first address page and # end on the last letter, so the last letter if there are 3 recipients might say # Page 5 of 6 on the address page and Page 6 of 6 on the letter. OPTIONS = { page_size: "A4", encoding: "UTF-8" }.freeze def self.call(letter) unless letter.respond_to?(:to_html) letter = LetterPresenterFactory.new(letter) end # NB not caching the pdf for now until we can find a more standard way of using the # letter cache across adhoc and env stuffer renderers. Here for example we should be # using a hex digest of the interleaved letter but currentlt would not be. # PdfLetterCache.fetch(letter) do WickedPdf.new.pdf_from_string( LettersController.new.render_to_string( template: "/renalware/letters/printable_letters/show", locals: { letter: letter, recipients: PrintableRecipients.for(letter) }, encoding: "UTF-8" ), OPTIONS ) # end end end end end end
Version data entries
58 entries across 58 versions & 1 rubygems