Method: OBF::External.to_pdf

Defined in:
lib/obf/external.rb

.to_pdf(board, dest_path, opts) ⇒ Object



319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
# File 'lib/obf/external.rb', line 319

def self.to_pdf(board, dest_path, opts)
  if board && board['boards']
    opts['packet'] = true
  end
  tmp_path = OBF::Utils.temp_path("stash")
  if opts['packet']
    OBF::Utils.as_progress_percent(0, 0.3) do
      OBF::External.to_obz(board, tmp_path, opts)  
    end
    OBF::Utils.as_progress_percent(0.3, 1.0) do
      OBF::OBZ.to_pdf(tmp_path, dest_path)
    end
  else
    OBF::Utils.as_progress_percent(0, 0.5) do
      self.to_obf(board, tmp_path)  
    end
    OBF::Utils.as_progress_percent(0.5, 1.0) do
      OBF::OBF.to_pdf(tmp_path, dest_path)
    end
  end
  File.unlink(tmp_path) if File.exist?(tmp_path)
  dest_path
end