Class: UDRS::Renderers::PDFRenderer

Inherits:
Base
  • Object
show all
Defined in:
lib/udrs/renderers/pdf_renderer.rb

Instance Method Summary collapse

Methods inherited from Base

#render_item

Instance Method Details

#render(container) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/udrs/renderers/pdf_renderer.rb', line 11

def render(container)
	# Create the pdf
	@pdf = Prawn::Document.new

	# Allow bold fonts
	@pdf.font_families.update(
		'DejaVuSans' => {
			normal: 'app/assets/DejaVuSans.ttf',
			bold: 'app/assets/DejaVuSans-Bold.ttf',
		},
	)
	@pdf.font('DejaVuSans', size: @pdf.font_size)

	# Render the items
	render_item(container)

	# Render the pdf
	return @pdf.render
end