27 lines
830 B
Ruby
27 lines
830 B
Ruby
|
|
module SampleCard
|
||
|
|
class PdfPrinter
|
||
|
|
|
||
|
|
def initialize(process, sample_cards)
|
||
|
|
@process = process
|
||
|
|
@sample_cards = sample_cards
|
||
|
|
end
|
||
|
|
|
||
|
|
def call
|
||
|
|
group_cards_pdf = CombinePDF.new
|
||
|
|
@sample_cards.each do |sample_card|
|
||
|
|
url = SampleCard::JasperUrlGenerator.new(@process, sample_card.family_id).call
|
||
|
|
puts url
|
||
|
|
sample_card_pdf = SampleCard::JasperPdfGenerator.new(url).call
|
||
|
|
|
||
|
|
group_cards_pdf << sample_card_pdf
|
||
|
|
end
|
||
|
|
|
||
|
|
employer_name = @process.employer_name.downcase.tr(" ", "_")
|
||
|
|
todays_date = Date.today.strftime("%m-%d-%Y")
|
||
|
|
group_cards_pdf.save("tmp/#{employer_name}_sample_cards_#{todays_date}.pdf")
|
||
|
|
|
||
|
|
group_cards_pdf
|
||
|
|
end
|
||
|
|
|
||
|
|
end
|
||
|
|
end
|