diff --git a/.gitignore b/.gitignore index aec92ed..48642aa 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ vendor/bundle/ *.log tmp/ +logo/ \ No newline at end of file diff --git a/lib/invoice_pdf.rb b/lib/invoice_pdf.rb index fc28e44..363abb7 100644 --- a/lib/invoice_pdf.rb +++ b/lib/invoice_pdf.rb @@ -4,6 +4,8 @@ require 'bigdecimal' class InvoicePdf FONTS_DIR = File.join($root, 'public', 'fonts') + LOGO_PATH = File.join($root, 'public', 'logo.png') + LOGO_SIZE = 52 ISSUER = { name_latin: 'IE Sergei Poljanski', @@ -79,6 +81,12 @@ class InvoicePdf end def draw_header(pdf) + if File.exist?(LOGO_PATH) + pdf.image LOGO_PATH, + at: [pdf.bounds.right - LOGO_SIZE, pdf.cursor], + width: LOGO_SIZE, + height: LOGO_SIZE + end pdf.font_size(20) { pdf.text 'INVOICE', style: :bold, character_spacing: 2 } pdf.move_down 2 pdf.fill_color COLOR_MUTED diff --git a/public/logo.png b/public/logo.png new file mode 100644 index 0000000..cd75a74 Binary files /dev/null and b/public/logo.png differ