logo in pdf
All checks were successful
Build and Deploy to Production / build (push) Successful in 1m2s
Build and Deploy to Production / deploy (push) Successful in 39s

This commit is contained in:
Sergei Poljanski 2026-06-08 18:15:23 +03:00
commit 8f3afcfcd2
Signed by: asxpi
GPG key ID: 4F8851660FA4121B
3 changed files with 9 additions and 0 deletions

1
.gitignore vendored
View file

@ -4,3 +4,4 @@
vendor/bundle/ vendor/bundle/
*.log *.log
tmp/ tmp/
logo/

View file

@ -4,6 +4,8 @@ require 'bigdecimal'
class InvoicePdf class InvoicePdf
FONTS_DIR = File.join($root, 'public', 'fonts') FONTS_DIR = File.join($root, 'public', 'fonts')
LOGO_PATH = File.join($root, 'public', 'logo.png')
LOGO_SIZE = 52
ISSUER = { ISSUER = {
name_latin: 'IE Sergei Poljanski', name_latin: 'IE Sergei Poljanski',
@ -79,6 +81,12 @@ class InvoicePdf
end end
def draw_header(pdf) 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.font_size(20) { pdf.text 'INVOICE', style: :bold, character_spacing: 2 }
pdf.move_down 2 pdf.move_down 2
pdf.fill_color COLOR_MUTED pdf.fill_color COLOR_MUTED

BIN
public/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB