Improve pdf more
This commit is contained in:
parent
4abae91a5a
commit
bf0548ecfe
2 changed files with 33 additions and 25 deletions
|
|
@ -5,25 +5,6 @@ module PdfDocuments
|
||||||
private
|
private
|
||||||
|
|
||||||
def generate
|
def generate
|
||||||
@prawn_document.repeat(:all) do
|
|
||||||
# @prawn_document.bounding_box([ 0, 790 ], width: 200) do
|
|
||||||
# logo
|
|
||||||
# end
|
|
||||||
# @prawn_document.formatted_text_box([ {
|
|
||||||
# text: "Dieses Dokument wurd am #{Time.current.strftime('%d %B %Y')} um #{Time.current.strftime('%H:%M:%S')} erstellt.",
|
|
||||||
# size: 8,
|
|
||||||
# align: :right
|
|
||||||
# } ],
|
|
||||||
# at: [ 0, -15 ],
|
|
||||||
# width: 200
|
|
||||||
# )
|
|
||||||
@prawn_document.draw_text "#{I18n.l params.report.updated_at.to_date} #{params.report.name}", at: [ 0, 770 ]
|
|
||||||
@prawn_document.font_size(8) do
|
|
||||||
@prawn_document.draw_text("Dieses Dokument wurd am #{Time.current.strftime('%d %B %Y')} um #{Time.current.strftime('%H:%M:%S')} erstellt.", at: [ 0, -15 ])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
logo
|
|
||||||
move_down 20
|
|
||||||
heading1 params.report.name
|
heading1 params.report.name
|
||||||
rich_text params.report.comment
|
rich_text params.report.comment
|
||||||
@pages = {}
|
@pages = {}
|
||||||
|
|
@ -53,13 +34,41 @@ module PdfDocuments
|
||||||
}
|
}
|
||||||
@prawn_document.number_pages string, options
|
@prawn_document.number_pages string, options
|
||||||
|
|
||||||
|
@prawn_document.repeat(:all) do
|
||||||
|
# @prawn_document.bounding_box([ 0, 790 ], width: 200) do
|
||||||
|
# logo
|
||||||
|
# end
|
||||||
|
# @prawn_document.formatted_text_box([ {
|
||||||
|
# text: "Dieses Dokument wurd am #{Time.current.strftime('%d %B %Y')} um #{Time.current.strftime('%H:%M:%S')} erstellt.",
|
||||||
|
# size: 8,
|
||||||
|
# align: :right
|
||||||
|
# } ],
|
||||||
|
# at: [ 0, -15 ],
|
||||||
|
# width: 200
|
||||||
|
# )
|
||||||
|
@prawn_document.text_box "<b>#{params.report.name}</b>", at: [ 150, 777 ], inline_format: true, width: 300
|
||||||
|
@prawn_document.text_box "#{I18n.l params.report.updated_at.to_date, format: :long}", at: [ 0, 777 ], inline_format: true, width: 516, align: :right
|
||||||
|
@prawn_document.bounding_box([-10, 800], width: 200, height: 200) do
|
||||||
|
logo
|
||||||
|
end
|
||||||
|
@prawn_document.font_size(8) do
|
||||||
|
@prawn_document.draw_text("Dieses Dokument wurd am #{Time.current.strftime('%d %B %Y')} um #{Time.current.strftime('%H:%M:%S')} erstellt.", at: [ 0, -15 ])
|
||||||
|
end
|
||||||
|
@prawn_document.bounding_box([0, 0], width: 516) do
|
||||||
|
hr
|
||||||
|
end
|
||||||
|
@prawn_document.bounding_box([0, 766], width: 516) do
|
||||||
|
hr
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
x = params
|
x = params
|
||||||
p = @pages
|
p = @pages
|
||||||
@prawn_document.outline.define do
|
@prawn_document.outline.define do
|
||||||
x.report.export[:elements].each.with_index(1) do |(element, success_criteria), element_index|
|
x.report.export[:elements].each.with_index(1) do |(element, success_criteria), element_index|
|
||||||
section("#{element_index} #{element.title}") do
|
section("#{element_index} #{element.title}") do
|
||||||
success_criteria.each.with_index(1) do |sc, sc_index|
|
success_criteria.each.with_index(1) do |sc, sc_index|
|
||||||
page(title: "#{element_index}.#{sc_index} itle}", destination: p[sc.id])
|
page(title: "#{element_index}.#{sc_index} #{sc.title}", destination: p[sc.id])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,8 @@ PrawnRails.config do |config|
|
||||||
config.page_layout = :portrait
|
config.page_layout = :portrait
|
||||||
config.page_size = "A4"
|
config.page_size = "A4"
|
||||||
config.skip_page_creation = false
|
config.skip_page_creation = false
|
||||||
config.left_margin = 48
|
config.left_margin = 32
|
||||||
config.top_margin = 48
|
config.top_margin = 64
|
||||||
config.right_margin = 48
|
config.right_margin = 32
|
||||||
config.bottom_margin = 48
|
config.bottom_margin = 32
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue