invoice_printer 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -2
- data/examples/czech_invoice.pdf +95 -73
- data/examples/czech_invoice.rb +2 -1
- data/examples/simple_invoice.rb +2 -1
- data/invoice_printer.gemspec +2 -1
- data/lib/invoice_printer/document.rb +47 -3
- data/lib/invoice_printer/pdf_document.rb +16 -2
- data/lib/invoice_printer/version.rb +1 -1
- data/test/notes_test.rb +16 -0
- metadata +20 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54e6e870b9c6dd877736812b7d41af08a48ebf72
|
4
|
+
data.tar.gz: 3661b458c65247c90f47fc1f2e2d7f9526c2cb4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22be70421a81c07eed5ba7b676e4f8dcb0d58a7c5ce83330eacb60396164df4782536dcb81820fee0fd3cd111f702851e5c8753bb1df7ba82de7eef6f889dd22
|
7
|
+
data.tar.gz: f0ca098063bb4b407a791d5a39a0487286beb106bb51d0913654323daaabfd5afcbb2e6cc238f22032d4a5c42cf7418440087f50eeb91422b1a0a73c8daa19cd
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ designed only to provide an interface to build the PDF version of these document
|
|
7
7
|
|
8
8
|
**This project is still in development. 0.0.x versions are all development versions.**
|
9
9
|
|
10
|
-
<img src="https://github.com/strzibny/invoice_printer/raw/master/examples/czech_invoice.jpg" width="
|
10
|
+
<img src="https://github.com/strzibny/invoice_printer/raw/master/examples/czech_invoice.jpg" width="193" />
|
11
11
|
|
12
12
|
See more usecases in the `examples/` directory.
|
13
13
|
|
@@ -23,6 +23,7 @@ See more usecases in the `examples/` directory.
|
|
23
23
|
- Configurable labels
|
24
24
|
- Configurable font file
|
25
25
|
- Logotype
|
26
|
+
- Note
|
26
27
|
- Well tested
|
27
28
|
|
28
29
|
## Installation
|
@@ -104,7 +105,8 @@ invoice = InvoicePrinter::Document.new(
|
|
104
105
|
bank_account_number: '156546546465',
|
105
106
|
account_iban: 'IBAN464545645',
|
106
107
|
account_swift: 'SWIFT5456',
|
107
|
-
items: [item]
|
108
|
+
items: [item],
|
109
|
+
note: 'A note...'
|
108
110
|
)
|
109
111
|
```
|
110
112
|
|
data/examples/czech_invoice.pdf
CHANGED
@@ -17,7 +17,7 @@ endobj
|
|
17
17
|
>>
|
18
18
|
endobj
|
19
19
|
4 0 obj
|
20
|
-
<< /Length
|
20
|
+
<< /Length 8111
|
21
21
|
>>
|
22
22
|
stream
|
23
23
|
q
|
@@ -698,9 +698,24 @@ ET
|
|
698
698
|
|
699
699
|
|
700
700
|
q
|
701
|
-
180.0 0.0 0.0 35.0 36.0
|
701
|
+
180.0 0.0 0.0 35.0 36.0 61.0 cm
|
702
702
|
/I1 Do
|
703
703
|
Q
|
704
|
+
|
705
|
+
BT
|
706
|
+
36.0 38.5 Td
|
707
|
+
/F1.0 10 Tf
|
708
|
+
<4f736f6261206a65207a617073876e61207620> Tj
|
709
|
+
/F1.1 10 Tf
|
710
|
+
<25> Tj
|
711
|
+
/F1.0 10 Tf
|
712
|
+
<69766e6f7374656e736b8e6d2072656a7374> Tj
|
713
|
+
/F1.1 10 Tf
|
714
|
+
<23> Tj
|
715
|
+
/F1.0 10 Tf
|
716
|
+
<926b752e> Tj
|
717
|
+
ET
|
718
|
+
|
704
719
|
Q
|
705
720
|
|
706
721
|
endstream
|
@@ -772,67 +787,74 @@ stream
|
|
772
787
|
endstream
|
773
788
|
endobj
|
774
789
|
9 0 obj
|
775
|
-
<< /Length1
|
776
|
-
/Length
|
790
|
+
<< /Length1 27572
|
791
|
+
/Length 14409
|
777
792
|
/Filter [/FlateDecode]
|
778
793
|
>>
|
779
794
|
stream
|
780
|
-
x�ռ|�y'zfopH
|
781
|
-
|
782
|
-
�
|
783
|
-
�
|
784
|
-
2
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
�
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
�
|
804
|
-
|
805
|
-
�
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
N
|
817
|
-
l
|
818
|
-
|
819
|
-
|
795
|
+
x�ռ|�y'zfopH�� � $!�_H��~��
|
796
|
+
A`H�"
|
797
|
+
)1~H��ږ�Xyl�U�����$�Ɛ�:r�6N��q9Ͷ���8n���o�4�m��uD�~��ey{����"8gΜ�����R�B����e��o��;�_���!De.�n/�)~�Ih���3�!�ϲf+@�jƜ[Y��I�)\�����++�/���P����5ߙ
|
798
|
+
�CHa�oE��P�{��<O�9��!�M��LmF&W(Uj�6�M�����,C6�A�y������R���L��U�����\�`ilB��C-��N^�&\�����;��_rt��{������P�� 4�h9��Q[]W�USk���3S5��3�3����VǶYW[�Y]�3l��mM&����
|
799
|
+
i��%F%�@c���h�2����M-`�mV=e���漭��f�@Wi�|�Dh?��ldR��R�_������������y&�������y�����n�m��,�7�-:X*���[X:�,�.�u3���g
|
800
|
+
�?piz���ζ��ƞ|����M�ы�4L�VW�oۼP&;�:5Vo?���c������ԏ?��o>a�k�8T?�^�4���q�܉�չ���bc�����WY��ɻ*+*8�Κ������
|
801
|
+
�V�,�n�a�ᖀk~6�m�l����b@�"4+q4PVI*�%f�>��g8Q�Z~��L}��`��wŻ��<��E6��]
|
802
|
+
L��$#2����皘��/럜�������3ӏ�
|
803
|
+
��K"�h��Y݊�f����K��y��wO��?���^
|
804
|
+
��PHv��+�ʷ]�D�9�eer�
|
805
|
+
��H��
|
806
|
+
�R��je�L����RE�^]F�L��ӌL�pi%�o�[��q��<�GJ ]��k��I��p����QM5PU��Rى��+�oӊ�Ҳ�o��4�iW�oS�{/�/}����l��bִ��sb�����4�2R����^]�R(
|
807
|
+
\��F��ԅ:g�h�l�*�E�yP�Ǡ�����`�y^Ld�A�)�b*���TO%�Wi㹯�S���=�Yش��~�>2ߚS�ڜۻFU�.��2����������ܳ�y������W�5XY?��s��x̦>�ioS�A8>|l߂���++��U���!�N�)ecV��h�C~:S�ju�\-����Gjd��>$�9�s�R1:W�����C[n:C�$��C�텅'��:�������G�<��v����'[����_+���|J�4��r��n�i���{��Ba��f�/:.����IL5BV�ק*5��N��tu�u1�B����D�LR��AJG��PW�R����O�����{.]po����y_o]�%���%�d<�llf���}"��z] ro���O���X�O�Q#��L�`�r�'_]D�Q)TH��@�&�@}��1<9c55Z��m��*��{��ӽ����N��{Ik��Т#�zr=�}^�--�e���t2NvQvY�)T�4�sVI)�2��F�G��.-��y��Л��.|d�����;�����K�_���z����iX�A�-,E
|
808
|
+
Q�\~�֫��4�'Cn��"W�|��50?V�ww���y��{�[@'�:t�.}��%�ˠ�
|
809
|
+
�he�v\JE>�4(RiP��Ѕ��Ɨ+/��~�[�S�>qϩ|���(�_f��y$�oO
|
810
|
+
Z��b&���L��HԖP`�e��G�]ˋ�r��!@��r�"g�dƽ�=t��{!j������@�^�{��'�[��!B!=
|
811
|
+
9�ڌ�Z�5hi-���!Sd�6
|
812
|
+
@�J�L*�%Hi\ϲϳ�b6�/Tv�����<&W���ZD.W�Eq[��v��ƥLp�8�*l����m��|�b��~�=7���w}��1FRcʗ�}g�#�ԗ��$EC�{�B,"V����2)���G^z|����{��"�]TD�[�����j�������k.�Ao��?|*�%�=gI��e����;�ϟ^�'�����/�~Lb_1ľ��>��X�K�����bT�P��9qJ!����z�i�)�q0����N������{L~i�7ּ�;���k���މ��qw�^}�"�Z�F���l��M��>�Oɕ��PȨ�1-���>6=��<��lN�̴Y-������J�D�|��V���Ʃ���/{?���;���z�o/*��9��X��������ݗ�܊��ڊaG�^?�����9Gr�l�}��"Wa��Yt��X�������Ξ�h��)DE�"ZUTTڟ�&��V|���m�H��ob�:q^T�m(�@)�Z,�9�6�LZ�:V~����C/./��#����8'���W���+�յc�
|
813
|
+
|
814
|
+
M��
|
815
|
+
�OzJ�/(P�4�ep�*͈J蜋��
|
816
|
+
zMA)�i6�~^O�5Z��T�ٶZ煏�:?O"%=Pw���-�.˼Xm�/I7b�����/5eb�R�Ҭ*��jˊ7�{��o3����ͷ����6�a�2~��{z�d����_�),<b�yؓ݃EEv&r������N����W_�Y`�oC'�UTN�au�M�-�P%%�iTZ{�Q{�H�S��?_,/.�2Y��8=����J�7)�h����q?
|
817
|
+
�&��j�s�a����HG�^�������I{yp.���`�}pz���j���cܚ{��������u���ݽ��˹E�U]u��yb��5�CN��Ec�5EŘ�*�*�GY]n�ְJՂ)5��r(�����]�pR�%j�l��M�8�J:|җP�R���1{g�z���刣���v�sg�k�l5i�H���:wR�����'�8����=�7͝�ʕ��Z�^��[�E�_�K�a�^2�M9c��QN��2ҩt��F ��*)�ƀqE�r�o�Ŝ<IJI�o�b��-���v8N%��7�2������]�6�r�_־�������x��s�q������h�����{g�]��U�\��l��;:JWU:�7-��k�2P~�4�Q�eOgJb�v��]�9O,'(����z)R�t���.G�����ꝝ��vϺ)���]s�!�s>���?�Ɠ��k���?��[��m���K��|e���!$a��@�%��:l�E�O�U�eԕg��k��Z�)K��<T�l����)W����4J]!UX�7U$2b��GN� �4��^gM�F����ND�`#)m`螵�}����_��ҽG�����?au�j��po��#
|
818
|
+
�0�,��+.��?���1��=�����uj^��k�\���B�_��9Yh1&K�x����e�L� W�s��^?���*��eT&�)�x�OY^�
|
819
|
+
��������:��Q��P @Z1�yC�t3�ފƊ��j���ZO�*��X>8���>�{�e�u��5�,h8vt��<d�U*6nG/�Uf�j�g�
|
820
|
+
�R�Vi���W�
|
821
|
+
B
|
822
|
+
�\�Ȩq���@Y�1�5F�En����^S�d5�1���S@i
|
823
|
+
ЀF�P�@#�J��k�w�Lo��fA�f��:�5�rgnh��DuME��6=U
|
824
|
+
�R�/�P-�b��c����#�E~7�r����F�=%/���m9~���(d�� I��H.[�SF9�!Cx*A���
|
825
|
+
�<�?��2Qt�W�)G�Q3��栱�څZ*��^;R˨��r�̕Sc�M�)�3������V�pg�?Efa��F|�Rr�D˚��"'Wr
|
826
|
+
��xO*8�����ҏྲ\>�B�7|6Z���˨1�ᾺPac���}�+gڵ~��������p��u�k]~wE���յ�����)���gύ���kl�;?6vn�Q|߹��6\�q�
|
827
|
+
�>)�(�b�W��d�ʔ2�LQ(���i��Ooإ�7�R�� yZ�jL_���4t7e��Ԝ��_�负z�������!Sf}�3?����[��_�l莳��?�e۳�K
|
828
|
+
ˡ��{�Kw
|
829
|
+
�Ǒ����Sg(�JZ)�}̯!#�#/�,h3SijEn�t^R%���X'�����7��*0���FR/�)�)���Y[�����ߪs���#��
|
830
|
+
����Ly��F_��^���7}?�c{
|
831
|
+
t�KY���9c���Q�;�L~a��_�)����\�B?MɴH�d�#�:�6��Z��!8- 'ɸ��Z&^�#ā.�N<��W�O�>�3�Y�o;�7�������4�;��(��Q��A�(�Y�2�4��J�l��$R*�t�j�(TR����.�S����)� R7~���;z����;�Q�J����,ww��:?���~�`ۋ�
|
832
|
+
���x�K�7�J6����1(M�6�"��X�PU�T��YE��R�(F�� Pe�` "˷�[u�ۏ�ɾTl��xDF��(+%���o~����hm�B���d;{�Y�|w��2?����+l.�g�W��R���h�e�B�0��Q�P=IX9�5�T��������~X[(|�@�f���v�zw���:��?����+ݺ%�a�?���K3�}��E��1R�I-O�W�Ͽ*<�ԑ�j���y����)�d�9�O�E�Yx�)�^��=C�
|
833
|
+
��AK�����踬>g�%Y���ςx}]����tڭ��%h��o�8�=F�`����h�Q�.�JV��ᓋN�@h��3Ɗ���3�`S�%M��W�4�4�O������;z���䐹uȂfAf6���L�H]Ŀ�#��#(�ȕ�1��S�Vo�7��;&�v��]�w��!�T���!b�H�+��8���o�����e'��U(��!g�ޜ�*"ʃ(\�
|
834
|
+
Q*F�_���AuȌ�QjDM�bdjEm�����#ȃ��DCh��Q4����BG�4�Ώ�yD(�@O"�TL-��v���d��0��O�/������P���~����~P���y��_�D2�F�e(/������~9*��(����V�j�O�1J4J�L�W!-m�U(�n��HO��jTF��5�0}N�נ
|
835
|
+
�Ճ|0�-/Z��
|
836
|
+
� �W���
|
837
|
+
��Ap2l@�F8t�F̄���F(%����0cC�,������hf�t3K������z0�#�ր P����0��^6��X
|
838
|
+
�A̓\p�;�����"ܚo�EV�����5Ln`�/]ٯ7+
|
839
|
+
㗠 �e��J��9�,%A�
|
840
|
+
����/��t�}�Rl�/: N�bJ
|
841
|
+
���,
|
842
|
+
��e�IJ`8�IY
|
843
|
+
�̀U�
|
844
|
+
�!G�Y����B�M�롰d1A�|�A��I���[L�o���RRS��W�@)�5>�@�JԤ��?�/�����be
|
845
|
+
�J�-�K�
|
846
|
+
�ᄜ��H���'�2)�8Q�8�DaN�(�&*E���5�z=��)��Kb���0 �
|
847
|
+
�틡y�,�9�_��b\#��q��Az� �I3�3�R���En�b�儸�46�q%,V�
|
820
848
|
�µvq~=
|
821
|
-
�ܰ��ԈI�f
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
Y��
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
��n�h�NE�!�~jռ?e�����k\K�I��.B��7�� �RiI������T�3��}�N��ǫ�Sw�\J�v0�;�C�LN���g������52��Wz�nD�c��O5�D?R<���n�nmG������I����S,���O�w�<�n]Ҭ�(|gI�S�I���ݼ�=�{�iN�����n��TUN�)��wA8��+H�ĝ���A�c}�S��J0�R��y�z�s�;�K!Z�Ϝ{���������>�b<���^f2��˕v-��K\�1%�bd���w�H8�_Bw�!�u���ҹ+���ߥS9���E����1��<K<� ���hƍ�{xG�7��^r�炞R�U�_J�n���<0n��h��;�=��'��WD�.�n4#>Ӛ TG����䙝�������h��q=�7I�3�!�E@: ��USQyɊ2V�K/� �um/���[��p{8��OD�$2'��)"�q�;E�9��O��g�0���� �2+ʪ�<Ŝ%#��_M������!��E��UH��lD�2n'�ԋ�ppp��H���<������ɪ�DnQ�N�d�t�'��s��N��āx%j�:`�i�#�7�� Ye��?�J�q�3�I�d�] �-h~0I���ل���n�r��Iw*�`� .9;���x���t<,�7��bK�Ke�x���r}L�R`�%��ҕ�PXC��)�
|
831
|
-
G��R�+y�4��D���6��AyJ=("��K��t����%���$P�o
|
832
|
-
LA_�i�����1�}&���.�b>ن���/-h3���g2�}O�Q�c����h~Q�u�{��S�Nɞ��&�Ӎ]���6ƨ��Ӡ���� ���n�z��+�s�0��u�s�6\T�So����<4�p̓S��y`�|͙�s5�O���oj�u�̯��g(�?�O���~�O�5iS��TFM���F3��QLQ5hJ]��bj詫z)��SW��W&'jk�*o��T��bԣ�� ����)����c3W(�ӳ?�$�)�M��.���A]�A=���O$=/ႪE�\ |M�ND��Ԓ�;��3S��c�#�C��^ϑ>���������ho�nmi���Y�*��̥�<�^��j5j�R!�14�,ns��X��*�O�6��×Ա㠫/uL�[ øԑ��o�C鈏�t\ꨳpn3��2sW���h?�2�r��=Dڲ
|
833
|
-
r��EI ���y+..F-p�X������]�jzͽ���h���B+VeBUuQ�AW�ۮ�H��ecL�����]%%���Z1EoLIhqA�=�]��vቫ:��P�0|�gb�&]`�.<��ƪͮX�'�K���,f�;Vkb�����\g�.�������{�A��Y�� �Km�!�WR��<~Ձ�"vnlF��B��E�����|�5�N��sN���`.��r/��[+y�s�\��O~���s1�baѿ�?}���%�mr&�pA��yu_i��x�0�b��Y�1��G�Apb�L���1��gŬn�Ź/,����yl�d���Wq/�`<�q�rzA)�3���i� ������� �Y�?��d�Ū��+!+�Y�۾��`̹�\����,�tp}�f��:P�����f�$
|
834
|
-
Q�P�v0N�B\f��:=�-�<�h C����f̼y�6����aY�L���f��E+�L����[1����@�)�>B�㗞}���m��<0qS6�w�C`�p�Ù�D���f��9�w�w�ֹ�W�6L��
|
835
|
-
>���D��dO��O�3��������+:��G'g��T�,���`���`��?�raa�6�A�/��](F���P�"-�1�=1���w��n�_����*��C��Q�����������ko ����w��C�*��?E�$���o�7P��H���3��k�gC5��R��E_����s� �s��Y���[���'��-��oGɃ
|
849
|
+
�ܰ��ԈI�f������ĝ}����`�˼(%1�����ą &�:,��P=�W�PȦE�;�G@*��� 3��!�HvY�I���K
|
850
|
+
!�I�S���,�/�;�^�G���;�^l��ڟe&q�v�Ԓ��[�!bb�`���P*���,E):�ڕ�h��q)��tz�����-��&F�&���n�;�������.��9�efn�;����`ĸsxr6�sx���̬{vZ��8���]����ry��p=0ox�����@tr�LIy�0��,��u�x���f��;9�i�Q'7����N
|
851
|
+
��������u%4~"���d��9������^��p�!�ڂO��.�OL-!G��Dc�E�"��+���3~|�!��v�g���G������M��(�{��4�I"/��w�>t����<H*�ƶ�-�g#j���!��~'B=��[���e�Dзt",������
|
852
|
+
�! �~�XN�A�$�>*Z��*X�!�,��%���<a%��U��B�SN���6�I��~bg�$��t�̍&��'����%��K⌄T|0R:A�2H�̪x½I�'*>%����u�/As�}M@(`��!�����DzD6�.����i�$^�N��B�^I���'�ۢ�c����
|
853
|
+
���Z /��t>"�u��W�/'�Ґ(�0�o6ɲ���i"I�=6&cd# �G�E�ڄv0#��R<�I2xt�c�"̌��$�J$��f��Q��n'Y�:�#�qU����k�p�!oI�I��E��a�����:�$� �� K�4-���ђtŜ��F�H���� 1Y%���H/��ܖ�R�7 J�G�$���~��~��#Hw3n�I& I�ڐd�͏��`�X%/�7K�VB"H8L����=�K<&�K`���;Rm=�20�S$r��ޤ�$��v������_O��0S��ę�DEl��H7a�!����%!%�#q��O�x��n��}��h!���2���%�w��>��*�$�I6�u"�,������K�e�sԗ,T��?൪a^�G��d�~qͰo�w���E�L�c�d���ͦ�^��M���/qh#BP����+�'R����V�>R�|'=H������}�:�s|�D�,a?�X��V�q�c�H�G��A���M���f?R�!�R�'XӇU�B�� #��8!u����n��`�C�徏��g�5�Α��H&Ix|�XY@�����L�����E��N����NN�,�x��aB�>C���K�4t���ǰw�s�C?�X����x�]#rI�4a�TMf��Y��4��-�,Ɏ%�:��V�JE���z<��qn�x������q-�%v�B�T?����D{�/�ğ��!b %iM���6��]w�S��W���!�do6B�d��;p۵/S�,kĿ;3!~
|
854
|
+
xyQs��".3J�����P/#>i!I:��P���X��T�R��o�w�;��f|�/U��b]"�*^> a��K����Gީ�KއU�*�s--�۟&Nn�=Jܲr+�iǶ�B���"��e�mĽT���vb/M$#�j#���W����c�������vS�!E����b����"uD�^�N-u�!�ºZ=��p��_�[�~l�w��/q��O��+I�ƣ����{N�a+�A�gZ�:�UUb�~p}���#"�ľl� X��S�}��:�Dw�U 1���H��VH͆gԋUy �dnE����d� l�� �Kg3k�$��q�5�텾�xN$� �Iڔ֓8P,��)��%��w�}�Dɦ����j��XYo�����6�zV��5B�S�5~�)b��ܹ�f��t��B�N�px��Ղ�z�I�9�x���sL�y�e�'����+䲻բ�;�����U�z��eC�?���q-�B$K���ވ�'$�J�%iZ�c"R����I;U��O��r)���t��39!��=$�B�O��>^�Ⱥ���K@<Ո�H��ǻY�Y�9�6��3�' ��b�_N��۫?��A�uI����%N�&�gw��@��%�n>�~��:PT9I��w��̺F� awʲ�?�3�m��N)�+��J�Vx������/�h�?r�Ţ���^��>�܋=���n{���^f,Wڵ|ػ:,q�Ɣ�o��A��<
|
855
|
+
U�M�]�n�B#���1n_ 6:6�v��Β>�Kh��1%��1f�8w���'����B]Z����1>�t�q_��HL_�1�b5��y�23�\�X� �
|
856
|
+
����/��n�2��'�(*t��p�<���B௴cy��-�M��،p�V��a�����ɫғ�)���$>}�T�U�^��V�b��z3H�|W�7<�bL�¢_}���%�mr&�pA��yu_i��x�0�b��YL1��G�Apb�L���1��g�,n�Ź/,����il�ed���Wq�/Za<�q�rzA)��3���q�0������� �Y�?��d��j��+%+�Y�۾��`̹�B��Ѕ�,�tp}���� t�.r�5����P�H��#p+��0����S{=�����ׇ@*1�+b�$Z:�cֹ#4a4TùyW��r�H�`�4���0�Pauz�GLx.��@�ta-�q14�͘xӬ l�1:�yò&��0
|
857
|
+
|
836
858
|
endstream
|
837
859
|
endobj
|
838
860
|
10 0 obj
|
@@ -860,7 +882,7 @@ x
|
|
860
882
|
endstream
|
861
883
|
endobj
|
862
884
|
12 0 obj
|
863
|
-
[229 229 229 229 229 851 229 229 229 229 229 229 223 395 223 493 649 403 616 604 646 605 600 537 615 600 223 229 229 229 229 229 229 695 666 649 685 229 559 229 707 293 564 676 229 804 709 740 642 229 675 604 589 229 229 852 229 229 229 229 229 229 229 229 229 532 562 518 562 546 229 562 564 255 255 549 264 849 564 566 562 229 403 475 378 564 520 229 229 538 511 229 229 229 229 229 229 229 229 229 229 229 229 532 229 229 229 229 229 229
|
885
|
+
[229 229 229 229 229 851 229 229 229 229 229 229 223 395 223 493 649 403 616 604 646 605 600 537 615 600 223 229 229 229 229 229 229 695 666 649 685 229 559 229 707 293 564 676 229 804 709 740 642 229 675 604 589 229 229 852 229 229 229 229 229 229 229 229 229 532 562 518 562 546 229 562 564 255 255 549 264 849 564 566 562 229 403 475 378 564 520 229 229 538 511 229 229 229 229 229 229 229 229 229 229 229 229 532 229 229 229 229 229 229 546 229 229 229 255 229 229 229 229 229 229 229 229 229 564 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229 229]
|
864
886
|
endobj
|
865
887
|
13 0 obj
|
866
888
|
<< /Length1 18916
|
@@ -938,23 +960,23 @@ xref
|
|
938
960
|
0000000109 00000 n
|
939
961
|
0000000158 00000 n
|
940
962
|
0000000215 00000 n
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
963
|
+
0000008378 00000 n
|
964
|
+
0000008593 00000 n
|
965
|
+
0000008760 00000 n
|
966
|
+
0000008927 00000 n
|
967
|
+
0000012703 00000 n
|
968
|
+
0000027203 00000 n
|
969
|
+
0000027417 00000 n
|
970
|
+
0000028779 00000 n
|
971
|
+
0000029693 00000 n
|
972
|
+
0000037771 00000 n
|
973
|
+
0000037986 00000 n
|
974
|
+
0000038314 00000 n
|
953
975
|
trailer
|
954
976
|
<< /Size 17
|
955
977
|
/Root 2 0 R
|
956
978
|
/Info 1 0 R
|
957
979
|
>>
|
958
980
|
startxref
|
959
|
-
|
981
|
+
39228
|
960
982
|
%%EOF
|
data/examples/czech_invoice.rb
CHANGED
@@ -67,7 +67,8 @@ invoice = InvoicePrinter::Document.new(
|
|
67
67
|
bank_account_number: '156546546465',
|
68
68
|
account_iban: 'IBAN464545645',
|
69
69
|
account_swift: 'SWIFT5456',
|
70
|
-
items: [first_item, second_item]
|
70
|
+
items: [first_item, second_item],
|
71
|
+
note: 'Osoba je zapsána v živnostenském rejstříku.'
|
71
72
|
)
|
72
73
|
|
73
74
|
InvoicePrinter.print(
|
data/examples/simple_invoice.rb
CHANGED
data/invoice_printer.gemspec
CHANGED
@@ -17,8 +17,9 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
18
|
spec.require_paths = ['lib']
|
19
19
|
|
20
|
+
spec.add_dependency 'json'
|
20
21
|
spec.add_dependency 'prawn'
|
21
|
-
spec.add_dependency 'prawn-
|
22
|
+
spec.add_dependency 'prawn-layout'
|
22
23
|
|
23
24
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
24
25
|
spec.add_development_dependency 'rake', '~> 10.0'
|
@@ -34,7 +34,8 @@ module InvoicePrinter
|
|
34
34
|
# items: [
|
35
35
|
# InvoicePrinter::Document::Item.new,
|
36
36
|
# InvoicePrinter::Document::Item.new
|
37
|
-
# ]
|
37
|
+
# ],
|
38
|
+
# note: 'A note at the end.'
|
38
39
|
# )
|
39
40
|
#
|
40
41
|
# +amount should equal the sum of all item's +amount+,
|
@@ -77,7 +78,8 @@ module InvoicePrinter
|
|
77
78
|
:account_iban,
|
78
79
|
:account_swift,
|
79
80
|
# Collection of InvoicePrinter::Invoice::Items
|
80
|
-
:items
|
81
|
+
:items,
|
82
|
+
:note
|
81
83
|
|
82
84
|
def initialize(number: nil,
|
83
85
|
provider_name: nil,
|
@@ -108,7 +110,8 @@ module InvoicePrinter
|
|
108
110
|
bank_account_number: nil,
|
109
111
|
account_iban: nil,
|
110
112
|
account_swift: nil,
|
111
|
-
items: nil
|
113
|
+
items: nil,
|
114
|
+
note: nil)
|
112
115
|
@number = String(number)
|
113
116
|
@provider_name = String(provider_name)
|
114
117
|
@provider_ic = String(provider_ic)
|
@@ -139,9 +142,50 @@ module InvoicePrinter
|
|
139
142
|
@account_iban = String(account_iban)
|
140
143
|
@account_swift = String(account_swift)
|
141
144
|
@items = items
|
145
|
+
@note = String(note)
|
142
146
|
|
143
147
|
raise InvalidInput, 'items are not only a type of InvoicePrinter::Document::Item' \
|
144
148
|
unless @items.select{ |i| !i.is_a?(InvoicePrinter::Document::Item) }.empty?
|
145
149
|
end
|
150
|
+
|
151
|
+
def to_h
|
152
|
+
{
|
153
|
+
'number': @number,
|
154
|
+
'provider_name': @provider_name,
|
155
|
+
'provider_ic': @provider_ic,
|
156
|
+
'provider_dic': @provider_dic,
|
157
|
+
'provider_street': @provider_street,
|
158
|
+
'provider_street_number': @provider_street_number,
|
159
|
+
'provider_postcode': @provider_postcode,
|
160
|
+
'provider_city': @provider_city,
|
161
|
+
'provider_city_part': @provider_city_part,
|
162
|
+
'provider_extra_address_line': @provider_extra_address_line,
|
163
|
+
'purchaser_name': @purchaser_name,
|
164
|
+
'purchaser_ic': @purchaser_ic,
|
165
|
+
'purchaser_dic': @purchaser_dic,
|
166
|
+
'purchaser_street': @purchaser_street,
|
167
|
+
'purchaser_street_number': @purchaser_street_number,
|
168
|
+
'purchaser_postcode': @purchaser_postcode,
|
169
|
+
'purchaser_city': @purchaser_city,
|
170
|
+
'purchaser_city_part': @purchaser_city_part,
|
171
|
+
'purchaser_extra_address_line': @purchaser_extra_address_line,
|
172
|
+
'issue_date': @issue_date,
|
173
|
+
'due_date': @due_date,
|
174
|
+
'subtotal': @subtotal,
|
175
|
+
'tax': @tax,
|
176
|
+
'tax2': @tax2,
|
177
|
+
'tax3': @tax3,
|
178
|
+
'total': @total,
|
179
|
+
'bank_account_number': @bank_account_number,
|
180
|
+
'account_iban': @account_iban,
|
181
|
+
'account_swift': @account_swift,
|
182
|
+
'items': @items.map(&:to_h),
|
183
|
+
'note': @note
|
184
|
+
}
|
185
|
+
end
|
186
|
+
|
187
|
+
def to_json
|
188
|
+
to_h.to_json
|
189
|
+
end
|
146
190
|
end
|
147
191
|
end
|
@@ -54,7 +54,6 @@ module InvoicePrinter
|
|
54
54
|
@@labels = DEFAULT_LABELS.merge(labels)
|
55
55
|
end
|
56
56
|
|
57
|
-
|
58
57
|
def initialize(document: Document.new, labels: {}, font: nil, logo: nil)
|
59
58
|
@document = document
|
60
59
|
@labels = PDFDocument.labels.merge(labels)
|
@@ -123,6 +122,7 @@ module InvoicePrinter
|
|
123
122
|
build_items
|
124
123
|
build_total
|
125
124
|
build_logo
|
125
|
+
build_note
|
126
126
|
build_footer
|
127
127
|
end
|
128
128
|
|
@@ -563,8 +563,22 @@ module InvoicePrinter
|
|
563
563
|
end
|
564
564
|
|
565
565
|
# Insert a logotype at the left bottom of the document
|
566
|
+
#
|
567
|
+
# If a note is present, position it on top of it.
|
566
568
|
def build_logo
|
567
|
-
@
|
569
|
+
bottom = @document.note.empty? ? 50 : 60
|
570
|
+
@pdf.image(@logo, at: [0, bottom]) if @logo && !@logo.empty?
|
571
|
+
end
|
572
|
+
|
573
|
+
# Note at the end
|
574
|
+
def build_note
|
575
|
+
@pdf.text_box(
|
576
|
+
"#{@document.note}",
|
577
|
+
size: 10,
|
578
|
+
at: [0, 10],
|
579
|
+
width: 450,
|
580
|
+
align: :left
|
581
|
+
)
|
568
582
|
end
|
569
583
|
|
570
584
|
# Include page numbers if we got more than one page
|
data/test/notes_test.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class NotesTest < Minitest::Test
|
4
|
+
include InvoicePrinterHelpers
|
5
|
+
|
6
|
+
def test_setting_a_note
|
7
|
+
params = default_document_params.merge(
|
8
|
+
note: 'ABC is a registered trademark.'
|
9
|
+
)
|
10
|
+
invoice = InvoicePrinter::Document.new(params)
|
11
|
+
rendered_pdf = InvoicePrinter.render(document: invoice)
|
12
|
+
pdf_analysis = PDF::Inspector::Text.analyze(rendered_pdf)
|
13
|
+
|
14
|
+
assert_equal true, pdf_analysis.strings.include?('ABC is a registered trademark.')
|
15
|
+
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: invoice_printer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josef Strzibny
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: json
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: prawn
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -25,7 +39,7 @@ dependencies:
|
|
25
39
|
- !ruby/object:Gem::Version
|
26
40
|
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: prawn-
|
42
|
+
name: prawn-layout
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
45
|
- - ">="
|
@@ -95,6 +109,7 @@ files:
|
|
95
109
|
- test/invoice_printer_test.rb
|
96
110
|
- test/items_table_test.rb
|
97
111
|
- test/labels_test.rb
|
112
|
+
- test/notes_test.rb
|
98
113
|
- test/payment_box_test.rb
|
99
114
|
- test/test_ext.rb
|
100
115
|
- test/test_helper.rb
|
@@ -118,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
133
|
version: '0'
|
119
134
|
requirements: []
|
120
135
|
rubyforge_project:
|
121
|
-
rubygems_version: 2.
|
136
|
+
rubygems_version: 2.5.1
|
122
137
|
signing_key:
|
123
138
|
specification_version: 4
|
124
139
|
summary: Super simple PDF invoicing in pure Ruby
|
@@ -128,7 +143,7 @@ test_files:
|
|
128
143
|
- test/invoice_printer_test.rb
|
129
144
|
- test/items_table_test.rb
|
130
145
|
- test/labels_test.rb
|
146
|
+
- test/notes_test.rb
|
131
147
|
- test/payment_box_test.rb
|
132
148
|
- test/test_ext.rb
|
133
149
|
- test/test_helper.rb
|
134
|
-
has_rdoc:
|