Class: OxPrintJob

Inherits:
AbstractResource
  • Object
show all
Includes:
Exceptions, PrintDrivers
Defined in:
app/models/ox_print_job.rb

Overview

The PrintJob model holds all relevant information in regards to the PrintJob It is possible to create a PrintJob for any other model that needs to be able to print.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from PrintDrivers

included, #print_with, #rendered_on, #send_with, #set_default_args

Instance Attribute Details

#action_printerObject

Temporary attribute for the print_job object to hold the instanciated printer (PdfPrinter, HtmlPrinter, CsvPrinter etc.)



36
37
38
# File 'app/models/ox_print_job.rb', line 36

def action_printer
  @action_printer
end

#downloadObject

Temporary attribute for the print_job object to hold the instanciated printer (PdfPrinter, HtmlPrinter, CsvPrinter etc.)



36
37
38
# File 'app/models/ox_print_job.rb', line 36

def download
  @download
end

#snap_shotObject

Temporary attribute for the print_job object to hold the instanciated printer (PdfPrinter, HtmlPrinter, CsvPrinter etc.)



36
37
38
# File 'app/models/ox_print_job.rb', line 36

def snap_shot
  @snap_shot
end

Instance Method Details

#perform(*args) ⇒ Object

enabling background printing - via OxJob & ActiveJob & DelayedJob



40
41
42
43
44
45
46
47
# File 'app/models/ox_print_job.rb', line 40

def perform *args
  context = args[0].delete(:context)
  if !download
    print_with rendered_on(args), args
  else
    send_with( rendered_on(args), context) if context
  end
end