Class: Renalware::Letters::Printing::CreatePdfByInterleavingAddressSheetAndLetterForEachRecipient

Inherits:
Object
  • Object
show all
Defined in:
app/models/renalware/letters/printing/create_pdf_by_interleaving_address_sheet_and_letter_for_each_recipient.rb

Overview

Build PDF for printing. We are targetting an envelope stuffer so there will be an address cover sheet in front of each letter. So for a letter where the patient is the main recipient, and we CC to the GP (no practice email address so snail mailing) and 1 extra CC (a contact) the output will look like this:

  1. Patient address cover sheet

  2. Letter

  3. GP address cover sheet

  4. Letter

  5. Contact address cover sheet

  6. Letter

Note however the we always pad each item (address sheet, letter) with blank pages to make sure duplex printing does not cause the next page recipient’s content to be rendered on the back of the ast page of the previous letter for example/

Compiles print content for all input letters and outputs the merged PDF to output_file. Allows batch printing if you want to print say all 2 page letters together. The caller may choose for example to send the output_file could be sent back to the browser for manual printing using (eg using send_file) or copy the merged PDF to a folder for automated printing.

Defined Under Namespace

Classes: UsingOnePdfForAllLetterSections, UsingSeparatePdfForEachLetterSection

Instance Method Summary collapse

Instance Method Details

#callObject



34
35
36
37
38
39
40
41
# File 'app/models/renalware/letters/printing/create_pdf_by_interleaving_address_sheet_and_letter_for_each_recipient.rb', line 34

def call
  # There is a choice of two methods of building the merged PDF. See pros and cons.
  # The other is UsingSeparatePdfForEachLetterSection.
  UsingOnePdfForAllLetterSections.new(
    letters: letters,
    output_file: output_file
  ).call
end