logo in pdf
This commit is contained in:
parent
2c1d66dce5
commit
8f3afcfcd2
3 changed files with 9 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -4,3 +4,4 @@
|
||||||
vendor/bundle/
|
vendor/bundle/
|
||||||
*.log
|
*.log
|
||||||
tmp/
|
tmp/
|
||||||
|
logo/
|
||||||
|
|
@ -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
BIN
public/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 47 KiB |
Loading…
Add table
Add a link
Reference in a new issue