br_danfe 0.12.0 → 0.12.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/br_danfe/danfe_nfce.rb +6 -6
- data/lib/br_danfe/danfe_nfce_lib/footer.rb +6 -1
- data/lib/br_danfe/version.rb +1 -1
- data/spec/fixtures/nfce/lib/footer#render-with_additional_information.pdf +88 -0
- data/spec/lib/danfe_nfce_lib/footer_spec.rb +14 -5
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4797e22c4338892c66b0cd3d68be10f286afd9bb5901cbbfc75f2517a1d057b1
|
4
|
+
data.tar.gz: 256d5000c34b831bf3f1ca10b4d32e1fb346f7249b9ad5484da21e19d769ebf8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8768877973c009a595a131be31bc03dd3cd6ce26fc6adfcc0eba600e71aea75a268b067afef2805b1aca4649990a8269942b95c8678910c7977ef7ea42608e13
|
7
|
+
data.tar.gz: a8aa93af20088a6acc235cfb31045493e91243352a8314b6b3dd0e97e11bbb812002f091a139aee5fa6b7e622a19066464b6915f9b71504452ce76eb237789e1
|
data/Gemfile.lock
CHANGED
data/lib/br_danfe/danfe_nfce.rb
CHANGED
@@ -11,19 +11,19 @@ module BrDanfe
|
|
11
11
|
@options = BrDanfe::Logo::Config.new
|
12
12
|
end
|
13
13
|
|
14
|
-
def save_pdf(filename)
|
15
|
-
generate
|
14
|
+
def save_pdf(filename, footer_info = '')
|
15
|
+
generate footer_info
|
16
16
|
@pdf.render_file filename
|
17
17
|
end
|
18
18
|
|
19
|
-
def render_pdf
|
20
|
-
generate
|
19
|
+
def render_pdf(footer_info = '')
|
20
|
+
generate footer_info
|
21
21
|
@pdf.render
|
22
22
|
end
|
23
23
|
|
24
24
|
private
|
25
25
|
|
26
|
-
def generate
|
26
|
+
def generate(footer_info)
|
27
27
|
DanfeNfceLib::Header.new(@pdf, @xml, @options.logo, @options.logo_dimensions).render
|
28
28
|
DanfeNfceLib::ProductList.new(@pdf, @xml).render
|
29
29
|
DanfeNfceLib::TotalList.new(@pdf, @xml).render
|
@@ -31,7 +31,7 @@ module BrDanfe
|
|
31
31
|
DanfeNfceLib::Recipient.new(@pdf, @xml).render
|
32
32
|
DanfeNfceLib::NfceIdentification.new(@pdf, @xml).render
|
33
33
|
DanfeNfceLib::QrCode.new(@pdf, @xml).render
|
34
|
-
DanfeNfceLib::Footer.new(@pdf, @xml).render
|
34
|
+
DanfeNfceLib::Footer.new(@pdf, @xml).render(footer_info)
|
35
35
|
|
36
36
|
resize_page_height
|
37
37
|
end
|
@@ -6,9 +6,14 @@ module BrDanfe
|
|
6
6
|
@xml = xml
|
7
7
|
end
|
8
8
|
|
9
|
-
def render
|
9
|
+
def render(info = '')
|
10
10
|
tot_trib = @xml['ICMSTot/vTotTrib'].present? ? BrDanfe::Helper.numerify(@xml['ICMSTot/vTotTrib']) : '0,00'
|
11
11
|
@pdf.text "Tributos Totais Incidentes (Lei Federal 12.741/2012): R$ #{tot_trib}", size: 5, align: :center
|
12
|
+
|
13
|
+
if info.present?
|
14
|
+
@pdf.render_blank_line
|
15
|
+
@pdf.text info, size: 5, align: :center
|
16
|
+
end
|
12
17
|
end
|
13
18
|
end
|
14
19
|
end
|
data/lib/br_danfe/version.rb
CHANGED
@@ -0,0 +1,88 @@
|
|
1
|
+
%PDF-1.3
|
2
|
+
%����
|
3
|
+
1 0 obj
|
4
|
+
<< /Creator <feff0050007200610077006e>
|
5
|
+
/Producer <feff0050007200610077006e>
|
6
|
+
>>
|
7
|
+
endobj
|
8
|
+
2 0 obj
|
9
|
+
<< /Type /Catalog
|
10
|
+
/Pages 3 0 R
|
11
|
+
>>
|
12
|
+
endobj
|
13
|
+
3 0 obj
|
14
|
+
<< /Type /Pages
|
15
|
+
/Count 1
|
16
|
+
/Kids [5 0 R]
|
17
|
+
>>
|
18
|
+
endobj
|
19
|
+
4 0 obj
|
20
|
+
<< /Length 306
|
21
|
+
>>
|
22
|
+
stream
|
23
|
+
q
|
24
|
+
0.3 w
|
25
|
+
|
26
|
+
BT
|
27
|
+
21.8858 130.0833 Td
|
28
|
+
/F1.0 5 Tf
|
29
|
+
<5472696275746f7320546f7461697320496e636964656e74657320284c6569204665646572616c2031322e3734312f32303132293a20522420372c3530> Tj
|
30
|
+
ET
|
31
|
+
|
32
|
+
|
33
|
+
BT
|
34
|
+
8.5039 124.1793 Td
|
35
|
+
/F1.0 6 Tf
|
36
|
+
<> Tj
|
37
|
+
ET
|
38
|
+
|
39
|
+
|
40
|
+
BT
|
41
|
+
83.3858 118.4783 Td
|
42
|
+
/F1.0 5 Tf
|
43
|
+
<496e666f726d61e7e36f2041646963696f6e616c> Tj
|
44
|
+
ET
|
45
|
+
|
46
|
+
Q
|
47
|
+
|
48
|
+
endstream
|
49
|
+
endobj
|
50
|
+
5 0 obj
|
51
|
+
<< /Type /Page
|
52
|
+
/Parent 3 0 R
|
53
|
+
/MediaBox [0 0 226.7717 141.7323]
|
54
|
+
/CropBox [0 0 226.7717 141.7323]
|
55
|
+
/BleedBox [0 0 226.7717 141.7323]
|
56
|
+
/TrimBox [0 0 226.7717 141.7323]
|
57
|
+
/ArtBox [0 0 226.7717 141.7323]
|
58
|
+
/Contents 4 0 R
|
59
|
+
/Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
|
60
|
+
/Font << /F1.0 6 0 R
|
61
|
+
>>
|
62
|
+
>>
|
63
|
+
>>
|
64
|
+
endobj
|
65
|
+
6 0 obj
|
66
|
+
<< /Type /Font
|
67
|
+
/Subtype /Type1
|
68
|
+
/BaseFont /Courier
|
69
|
+
/Encoding /WinAnsiEncoding
|
70
|
+
>>
|
71
|
+
endobj
|
72
|
+
xref
|
73
|
+
0 7
|
74
|
+
0000000000 65535 f
|
75
|
+
0000000015 00000 n
|
76
|
+
0000000109 00000 n
|
77
|
+
0000000158 00000 n
|
78
|
+
0000000215 00000 n
|
79
|
+
0000000572 00000 n
|
80
|
+
0000000888 00000 n
|
81
|
+
trailer
|
82
|
+
<< /Size 7
|
83
|
+
/Root 2 0 R
|
84
|
+
/Info 1 0 R
|
85
|
+
>>
|
86
|
+
startxref
|
87
|
+
983
|
88
|
+
%%EOF
|
@@ -27,16 +27,25 @@ describe BrDanfe::DanfeNfceLib::Footer do
|
|
27
27
|
subject { described_class.new pdf, xml_footer }
|
28
28
|
|
29
29
|
describe '#render' do
|
30
|
-
before
|
31
|
-
subject.render
|
32
|
-
File.delete(output_pdf) if File.exist?(output_pdf)
|
33
|
-
end
|
34
|
-
|
30
|
+
before { File.delete(output_pdf) if File.exist?(output_pdf) }
|
35
31
|
it 'renders footer to the pdf' do
|
32
|
+
subject.render
|
36
33
|
expect(File.exist?(output_pdf)).to be_falsey
|
34
|
+
|
37
35
|
pdf.render_file output_pdf
|
38
36
|
|
39
37
|
expect("#{base_dir}footer#render.pdf").to have_same_content_of file: output_pdf
|
40
38
|
end
|
39
|
+
|
40
|
+
context 'when has footer info' do
|
41
|
+
it 'renders footer with additional information to the pdf' do
|
42
|
+
subject.render('Informação Adicional')
|
43
|
+
expect(File.exist?(output_pdf)).to be_falsey
|
44
|
+
|
45
|
+
pdf.render_file output_pdf
|
46
|
+
|
47
|
+
expect("#{base_dir}footer#render-with_additional_information.pdf").to have_same_content_of file: output_pdf
|
48
|
+
end
|
49
|
+
end
|
41
50
|
end
|
42
51
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: br_danfe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ASSEINFO
|
@@ -291,6 +291,7 @@ files:
|
|
291
291
|
- spec/fixtures/cce/v1.00/cce.xml
|
292
292
|
- spec/fixtures/logo.png
|
293
293
|
- spec/fixtures/nfce/lib/document#render.pdf
|
294
|
+
- spec/fixtures/nfce/lib/footer#render-with_additional_information.pdf
|
294
295
|
- spec/fixtures/nfce/lib/footer#render.pdf
|
295
296
|
- spec/fixtures/nfce/lib/header#render-homologation.pdf
|
296
297
|
- spec/fixtures/nfce/lib/header#render-long_name_with_logo.pdf
|