invoice_printer 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -2
- data/examples/background.jpg +0 -0
- data/examples/complex_invoice.pdf +138 -24
- data/examples/complex_invoice.png +0 -0
- data/examples/complex_invoice.rb +2 -1
- data/lib/invoice_printer/pdf_document.rb +2 -2
- data/lib/invoice_printer/version.rb +1 -1
- data/lib/invoice_printer.rb +5 -3
- data/test/background_test.rb +21 -0
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1a1a8627880008c1a2649c81e9c111293174f7a
|
4
|
+
data.tar.gz: f3b9a8bbd8f68c316497ef0d20c41d7bcfe43585
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64c5b2e41e6699883cef4771215cc5010519dcbaf81c37a2807347e6a5529aa3fe63c890d4f3f9cf1d9eef29f7a24775bafac185b410a11fdbc52ec96538d2bb
|
7
|
+
data.tar.gz: fa516cb4c41cdf47e70de492bac1fee3411db89af8c795af1f706b83792791bbe450068c39295985dc9d15b5fb38d7e8063180e803f900f8048384eb2694b007
|
data/README.md
CHANGED
@@ -8,7 +8,7 @@ designed only to provide an interface to build the PDF version of these document
|
|
8
8
|
**This project is still in development. 0.0.x versions are all development versions.**
|
9
9
|
|
10
10
|
<a href="https://github.com/strzibny/invoice_printer/raw/master/examples/complex_invoice.pdf">
|
11
|
-
<img src="
|
11
|
+
<img src="./examples/complex_invoice.png" width="368" />
|
12
12
|
</a>
|
13
13
|
|
14
14
|
See more usecases in the `examples/` directory.
|
@@ -25,6 +25,7 @@ See more usecases in the `examples/` directory.
|
|
25
25
|
- Configurable labels
|
26
26
|
- Configurable font file
|
27
27
|
- Logotype (as image scaled to fit 50px of height)
|
28
|
+
- Background (as image)
|
28
29
|
- Stamp & signature (as image)
|
29
30
|
- Note
|
30
31
|
- Well tested
|
@@ -165,9 +166,11 @@ InvoicePrinter.labels = {
|
|
165
166
|
}
|
166
167
|
```
|
167
168
|
|
169
|
+
### Font
|
170
|
+
|
168
171
|
To support specific characters you might need to specify a TTF font to be used:
|
169
172
|
|
170
|
-
```
|
173
|
+
``` ruby
|
171
174
|
InvoicePrinter.print(
|
172
175
|
...
|
173
176
|
font: File.expand_path('../Overpass-Regular.ttf', __FILE__)
|
@@ -176,6 +179,17 @@ InvoicePrinter.print(
|
|
176
179
|
|
177
180
|
We recommend you DejaVuSans and Overpass fonts.
|
178
181
|
|
182
|
+
### Background
|
183
|
+
|
184
|
+
To include a background image you might need to create the file according to the size and resolution to be used (see: [examples/background.jpg](https://github.com/strzibny/invoice_printer/blob/master/examples/background.jpg)):
|
185
|
+
|
186
|
+
``` ruby
|
187
|
+
InvoicePrinter.print(
|
188
|
+
...
|
189
|
+
background: File.expand_path('../background.jpg', __FILE__)
|
190
|
+
)
|
191
|
+
```
|
192
|
+
|
179
193
|
## Copyright
|
180
194
|
|
181
195
|
Copyright 2015-2016 © [Josef Strzibny](http://strzibny.name/). MIT licensed.
|
Binary file
|
@@ -17,10 +17,15 @@ endobj
|
|
17
17
|
>>
|
18
18
|
endobj
|
19
19
|
4 0 obj
|
20
|
-
<< /Length
|
20
|
+
<< /Length 9155
|
21
21
|
>>
|
22
22
|
stream
|
23
23
|
q
|
24
|
+
|
25
|
+
q
|
26
|
+
612.0 0.0 0.0 842.0 0.0 -50.0 cm
|
27
|
+
/I1 Do
|
28
|
+
Q
|
24
29
|
/DeviceRGB cs
|
25
30
|
0.000 0.000 0.000 scn
|
26
31
|
|
@@ -753,12 +758,12 @@ ET
|
|
753
758
|
|
754
759
|
q
|
755
760
|
142.0 0.0 0.0 75.0 434.0 188.728 cm
|
756
|
-
/
|
761
|
+
/I2 Do
|
757
762
|
Q
|
758
763
|
|
759
764
|
q
|
760
765
|
49.6479 0.0 0.0 50.0 36.0 71.0 cm
|
761
|
-
/
|
766
|
+
/I3 Do
|
762
767
|
Q
|
763
768
|
|
764
769
|
BT
|
@@ -777,37 +782,145 @@ endobj
|
|
777
782
|
/MediaBox [0 0 612.0 792.0]
|
778
783
|
/Contents 4 0 R
|
779
784
|
/Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
|
780
|
-
/
|
781
|
-
/
|
785
|
+
/XObject << /I1 6 0 R
|
786
|
+
/I2 9 0 R
|
787
|
+
/I3 11 0 R
|
782
788
|
>>
|
783
|
-
/
|
784
|
-
/
|
789
|
+
/Font << /F1.0 7 0 R
|
790
|
+
/F2.0 8 0 R
|
785
791
|
>>
|
786
792
|
>>
|
787
793
|
>>
|
788
794
|
endobj
|
789
795
|
6 0 obj
|
796
|
+
<< /Type /XObject
|
797
|
+
/Subtype /Image
|
798
|
+
/ColorSpace /DeviceRGB
|
799
|
+
/BitsPerComponent 8
|
800
|
+
/Width 612
|
801
|
+
/Height 842
|
802
|
+
/Length 32511
|
803
|
+
/Filter [/DCTDecode]
|
804
|
+
>>
|
805
|
+
stream
|
806
|
+
����JFIFHH���ExifMM*>F(�iNHH��d�J��8Photoshop 3.08BIM8BIM%��ُ�� ���B~��Jd"��
|
807
|
+
���}!1AQa"q2���#B��R��$3br�
|
808
|
+
%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz���������������������������������������������������������������������������
|
809
|
+
���w!1AQaq"2�B���� #3R�br�
|
810
|
+
$4�%�&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz��������������������������������������������������������������������������C ��C��'��?��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(�JZ(��(��(��(��(��(��$&E<+�`U՜H�f1�5��k6�\YO=�z�}G���-�� �`����
|
811
|
+
�v�z�>�����c���&�r��h���}�䷴]��8 {�P;��w�
|
812
|
+
!��7Zk�'�-��ޭh���HKg�^= ��������A0Q�|䞵�]x{N�P�R�Q,������'*�z��~{���+�k�Q���N6IͿ^����\�/�BO����}?���J~M1���ִ�x�wVD1d+1��5���{~�Z�w6�9�[��+I�x��?y�H<��_
|
813
|
+
y�<c쏆����u*i_�O��c�uVk�#��D�uyq�,1_}�x��bZ��S���wC�����Q_��X��PNT���������?Gh�]Yӵ��=&�.��d�X�<n��a�A�5�_�S�g8;��kf��j�0��*�QER[�*�!�Ϳ<����t`P�=)h��
|
814
|
+
(��
|
815
|
+
(��?����(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��0J(��
|
816
|
+
(��
|
817
|
+
(��
|
818
|
+
(��
|
819
|
+
(��
|
820
|
+
(���x4�ڝP��G&�rQNL'��)P
|
821
|
+
Ĝ^��/��׳�����H9���q�Jd -�>���q)��s��^D�7!���� ��+1c���6&��������LEKָ(伆A19gb�rG�5�؉B�ng�������k�r�1�G�Q�( ��Z�<C�t�ao����![��@5���G3�{��<
|
822
|
+
�#�j�1U������%�+�2.u3yc��R:m�C�ΛS���y-�Lg��9��M�4���3��PI*{�*�>��Iz�\1v�������Z)F���&���*N+Dy=�嶱mn*��.W�PG��$��ֺY� n8���0�{�ϧ?�+g�^��Aug�$`~���Y1��� �~�?�>���Rt�N5����L�.h��j�N�G�ƣ �p2I�aQɤAw���t���X���5���ΑA�҃�rky��m�]�����MW�����w�����c�;�t����3p�7z%�����wǴ�� �����~����<����c#i:��e�;���i���i?vU%O�9�b�;x��ˎU�c����Iት{�?xwP�M�t��m��o.H%�0� <��l`�2��q?���#u(;^�j˻�����[�r<��'��1����o�%�y�K��?�~Ns���<?f���jֿ~4l<S$dY�BB��<�c)�%�'�J|���B˒s��D�Y�7¬V
|
823
|
+
w[4��_i.��j�6�o�~__Yѯ?����_��R�4�ޝF{Gs�(��
|
824
|
+
(��
|
825
|
+
(��
|
826
|
+
(��?����(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(�'q�ʹ��+�>'�g��t�ڎ�v�����&2��BF����{x�<va��Q�#5-���%ݷ�KV쒻6���W��F-��_���=�yB��=N$�%��q�������n�֢l�7�H�vH�`����N����w�j߆�1�_�_����@��*�n����#%S��?�������W���i�gj��6�֚M�.���\��Ӿ�{$�8��^>O�׳���k���b���兇�]�k�:��K�4G1DX�
|
827
|
+
�!�ɯ���<~WҠ��o�Y�?�]8{�ؕ�0��}1��l
|
828
|
+
L
|
829
|
+
�y]5ia��������S��+���u�9|!�G���9������=y��?d��7�o��RF1O�U�������i��W��༊�9%������G�K���G<��w�y|��u��ڟ����RIp�C�۪����!��~_�LTs��I�y�[\y�]2H�!��0��}6ȣߌ�~ŔR1���|8����ۯ�,��BL�����~��5�c͕Vq��m��/�[��]u>��u/ˋ��x������$7���𣃶!�B0x�ҹ����r��m^���s_Z�����4��=L��k�7g�U���{s���s����
|
830
|
+
��A���b$1a�ҿ�3��ե����uN/�{���K��w~f�F�rń���z���^K�z��/f�pX��Jz��=��*� ��;Ԝ(s�T�t�W�̞E��U��ZQC��Y�v�UU!K`���x��_f�R۹�]���]�:�j��LvSz��g��Wۿ�6��h?4X5������a���X����O��+�'#�|C�O
|
831
|
+
���5������¦��"��� o�KY�gk�9T��_��Q,JTu8��_w�Ʈc<�#*Pk�]�N^�iEy��>W�s���m��--�ӻ�[�v�)�����1�QEQEQE`�Q@!����UOQX�օ��m�k6��� 9I0��C���B�S8Fqp��{��FN-4�>N�������"����pX���qB��w�C�:G�>\oi�Z@ĪLͷp�
|
832
|
+
�Ԩ`O=G�5����n7.��&<���גj��-.��zY��o��,uRN����^MK���zՄ��b��m��\��g��� g��^�swomc%���X���1��q��~�5�OW�9����r˂��� `z�W�k�E���5\��g��FS����=�s�[��&ޫK����wջ%���ԣN],���ګ�=��w�?ڍ;�Zt�\E�XHm�_��G+��� ��=��o��u�ں7�U�n���R�4�7�j�����8��@u���h|��+����� ��Z�a)����¾c־|s�|l?k����<e��mJ�+���
|
833
|
+
S����u4z4�i�9��q���0�̴��Q*�d*J��^��'�-�O���<�0����A�2�ד]��?�s���O��,�����}ܚ�(��(��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��)4��uV�KrF5���V��_�c�>[%������ʵ���C+?Ձ���~+��/�uo^�0�vwL���P�3�2F=����h'���˄�ּE����ؾl�8E�a�ҿ%�O5~���ެ���N
|
834
|
+
pF?_N�fخX�8�x�k�I�[�Y� �9�⺄��_)�(1���ڿ5�^g�s�jl|��-�f�sێ��6�5�����
|
835
|
+
�:���f+;rx.��`�O�:�jV��[P�l�rN9�ې;W�?����=/��.�U�������V1�s��^�+LU�ͱ�*¾Nd�9������Ng{A>�٤�|vaOC���]��-��u=/�}�1���>���7�H�Z��5�ܿ�$=��*��U@��ꪼ(�M�c5%I�}�ZpJ)y/��{��?*�b*W�*�]�'v��QE�bQEQEQEQETR�1����e�x�QE�U��▊f�(W�ߴ���������l��������H$�����ɟB0��%V�\���qf9v��MN�՜^�[=��jta�Up�cZ��d�k����n��|H�'��Vگ��������N�#���f,����W�x����Ci��\�\���2tڬ29�Pq�½��
|
836
|
+
��J�m��_��������&�l�̀+���tr�Ё�h� ��I�����a��26mD�$���=�����J�6;�&�!(�-�]'��������3��6�6��*��U�KF����q�!��kG���� ����W
|
837
|
+
|
838
|
+
�����Il4O�-�ԩ4-�� `�Pm=@<�:ֶ��
|
839
|
+
�!xS����_�.�摯��g0�8n:���"������Kk�?�G}����qR7y����G_��}���~��o�>+���_q/���
|
840
|
+
�~���rV��V���^�^�{�[���>k��8̺�aN����x=�ߕ�~�^G�EC�wg��d�P(��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(���;��Ԭ4�كŏ|�_�l�G�t�Ȋ��b~zxM'�ö����]������b�����=���.���,ږ�
|
841
|
+
̒��ay���tۚ�D���G�v��=��;u�ҿ��C�*�Rմ�|�Tn�w���3�"��߽I�1:���Su���Ӟ�Zݎy쮂�G��<��N��8]bۤ��u ����g������x���r���"����?3�kMK��ŏ�^�]ڙ�lg7�A��c��>vڤt��z�a�P�T�G����ou�w��0R��r�S��Q�Wڱ�+�
|
842
|
+
E>W��� ����㟎��|%�jVZ�|��f�c�ζ�%���{9$GierfUpUAU%�|k����luKN��RM�J��Ev����}O��ʍJ�,���&��W���j����������xr��}�����|��m�~��e�'���ٷR�E�+�VZ�3�
|
843
|
+
�����M+�V��{�0�y�
|
844
|
+
��P��/ 83�i'i^+��E${T��_��[��^_�0�Y��Y�U�7_�N���f1��3%��^r�Ǟ�~{W�ë��[ட�;O,��%� �=���u��+�Ox�4�qY}\b�˟�4�����/nV���x-�b���II�r��]h�g��������,~��
|
845
|
+
k����>�V�mE՜�7%$�D<��H��~��?CW�9��|k��W������V��6&_�Y $N�j1(��R���=�[�6����;�C2��b��̓����4ߙ��e�1�pr�E�����KEW�x�HT�3KE|#�#�=u��C�N��Z��[H�k:rm
|
846
|
+
�`O�!H#��+�xf-.�_5�!
|
847
|
+
��#,W9��|G�x�T�Ѥ�X��F��Ȍ���z)����q��e����K{%k+>��K�a+��i/���SP��
|
848
|
+
��E�w7��3m�����D*����ഃ�?���6!��=s����z�M��d�:w���^��6���,Σ���7�O�
|
849
|
+
(���Y�5,�h�H;�d�)Wd��dT����(�����
|
850
|
+
�����~�1���c�|7�l��TZIg�谳K�CE���vbU���q�vs�~~�h�۫����{���?< �
|
851
|
+
���?� "�Q�A��M�<9�T�$W�q�y�a��q�nt6I�=T����%̼ϩ�x���j�h�>fړ���I��T���+�Y�#���j� U_�1K_b|��?��[߂0��%�jt���V��@m�:0<�� �5�N��]꿲/���<��C��fo�k(Q��+����a߷O�����q�S�~�*�m�xKY�fbLV��Q�2��U�;��9�i�??b�隹hf�D�i�$��c� �7a~��_�?H��x$����� �����,>*�9Ay}�ќ_�_��_��h�)�E��Ce���w��NX�:�yV�&9h��F͜�Q�_�����F:����
|
852
|
+
S^�O+�d�F�s
|
853
|
+
1�����J�u�_/�o�vE�FK��vA��8�+�8�����4��Z�wO����m^ܺz����+h���b���=�hZ/���"�G�3�*��h8ɯ�7z�X���߅���Ï~�����~$_�>�l�KY�(#C���{���+����'��/^�QԵ
|
854
|
+
-�Τ$��}4�_�ocS��=�J1Q�M��_C�
|
855
|
+
+��w��K�����|����B���&@tof���)�"�z�r�XU�j�w��i��{5����E��Y��EV�?����(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(���;���ݥ�T�fU=�US�¼�[nv6��$����Gʿ�l���1��H~5�R�����U]ʭ1�|�X1����A"�b�S�9�p=����W1^�x��۹����f�d�9�N6�d�̣M��Zv=��1��u-������>7�&�|�C<D����9����m ����9����M���`��$.{W���z7ċ��wchʌ��(>W\�k���.��.A��=�l���7'�S��q:�-ŵ���K��u��*�P�xl�^F���\�v�l fF����0�8���U� �W�ßY�����6L�ʞ>�"�����Y�<���,H͆S�`}{���+����1�����Ί�0d�Ҿ���}}���)�V���%����[���>o?�V*��8��U�����F��5�=/Ķ_n�������Gc] 9濡(W�Z�jҒ�^��Q���(I�J�EVĆ�EPEPEPFPEPEPEPY�q^5��E*�������������:�z�%ϙ���v��=����2��ak���-�"�Yٔ�O��W�m�p�C�Vm]�v�����I�ʼ��Z&y��o]ncc*�'�*d]��oL�����y�]B4��㵎Xл���9��) �O�]���x�6��zC$ە��u�1�@$r}�:�H<;���\K&����>V��>��ю����9;RJ���կ%����S G�ӊ�x<�>�,���f�x���n����#�|�&����eə~�����
|
856
|
+
��v�C����"4X�B8N@�{��
|
857
|
+
9��g=�+n��qڶ�[qP0 g����9�Y�������`�}�Vi�S�3x���1��x�Q��:~�0v@<��Wy^�!��@��F�qO&"9g+N-ǛK;u߮��?i���Z}Rv�z�Qjs�M:���������e��Q�����"��[�l���fTQӒ ���>¶$�V�)1J@(-���;qȯ��aܥ' 4�w����OEt}�↳�}Z+���(�)�������O�2HϽ~��ޛ��j�T�{y��u錑�+���(dl4��2�6���}9��_\| ��g���ӵ�1闒���e<}�z�د�<?⇂k���e���m���.���S퓭I{���{QT4��{�U���e��*�AR=����~�)%(��j�0��*�QEQEQEQEQFq@E) P��n��?�!ŠG��h��e&V^���c��4���KY���#�
|
858
|
+
���5;��$��L̥Kmٷ �w63^��k^��uy�P� �Dd�ҷD\u�oz��`�J���q��
|
859
|
+
s����R�sY湅Z�[K[-���n_����[��
|
860
|
+
�>o� `z��
|
861
|
+
m%��Ւ�����h��iQ�&����������X�H��0���X�O�鵳�{��W�h������'�"���/؉_��LFӎN��y��mv�L��m2$���#�!��%H#������_"~���^�����ϊ�up<3����H�m�n��5Ą�HC��+�W ^x�P��)�E>i��T�������Te'���|m,,jck>XEj�m����(�Q$s�K��9����G��:{W�)���
|
862
|
+
P�:S~�c��iY���b��N���o��(��9�(�����(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(���tބV�'b���Jǹ+�q�z��Ք�)��f�$A��
|
863
|
+
1�Kc��#ӥ��r�t���)s>�ɥ��m%m]���������Iۢ^�J�[U��n-��d��~T�T����G?�zN��X��o��gn'>��/�G��,��$j�X���ӿN+�
|
864
|
+
(��30��(����(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��Cڸ�~$�z�u� �k��kr��k�0NT%n��PiM\����pe`q\���.�3{mli!t\�>��Q�\ºB<����*k�ձ�=G־6�=�%NOt�f�s�ⶱ���ɾ&��-㿉�<a;������ڄ�>����,]���`::j��V�����H0�~P�⾾���?�
|
865
|
+
I�K��/���2i^0�-��s�h�)�nk�?�������-�[hI���#8*T��d
|
866
|
+
㵟�Q�w��2)RX��A����y=pH?�{8�3�ST��i*����N-=��Z��zt�N*|���y8�I'����%��F������>0����rsk�G�L�7�T��.�+���?jY���2�2�lz-��6qȜ�u�C�[q��zT�6�cg&�e��e@8�2�t����}/J��; �
|
867
|
+
��
|
868
|
+
�6���W'���_�9�y�ք3Z��gzt�'uk��Ik���G��^��y��������̧��oA����"�.�Ln�G���z���Zmr(v�1�7�<2�
|
869
|
+
�VF��>�z��w#j�-��Z�n#�Gy�>��s��b����*tcʓZy++���tW\��wgV5���p�����:V]��Ƌsd�v����Y�j�w��z�,�����1]6�{k}e���6Ld�}�kԄ�梦�����,�ѝ2B}�yY8�����ÊH�X�.'���j�䓜���O<�%���`b?.c��LZӷa�K:����!L�d����V
|
870
|
+
'�C]|;���t��>��}ZX�4���a*[�f\FR����+��q�(7g5gv����w��U��Wg����_%pWn�������5�#�A��ߴ��
|
871
|
+
U���T�O�t�x��M��d����0��G �F=+��S���Ŀ����#��V��z���Z��6ɢ=�IC�pk�����6�m3G�w@�s�{W�s�O|;�d/��m(>���Q�"���l0��:~�F�y �_�����N�*|�N��'w���[������Ҹ3��e�v�o8�}��k�g�2���t�AyUH#��#�z�?�6��a��2l���=:��u=��E����c�7+�B��;�v� �j�T��`'�rco65P�#�#�~I��V�3� %ng++�Z�-��TϠ��ɶ���_��o��K�7��RI�>�������J��kt�_1d��� ��1�'�=Mu"�zY�-ِ�S.������=��d�G� n���n�~��I�0wdmS�rA�Gg����mu����KZ���RR��K�5��v=V�!�"<���q�^����w���^��<K,_,�.��G��;w��߈�ĺ_�#ռ'����ڢ9%,�������r3�ޯ�<b�<�ѼX�c��@em�FXci���g���s��c8���t�o-��]t��W+u=4�����ԛ�e��m��Q���T�����,�Vkd�$�c���I���!��[)�sv���m'#={W��:��Y,����G8�z��=
|
872
|
+
�ĿgE�g�w����IF�ߡJ-J/�F��
l�
|
873
|
+
�Aǯ�lj1^]O����A �:���PKf�2� �w��
|
874
|
+
+��(��&�t_���m4$�Q_Ns�Q@Q@����(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(���� 9�OBri�W�*8a����}jm��:�7#Ҽ�]��As 89��^�T�uk�
|
875
|
+
��_���3��U;���s���~��Q��S���6��-��M��<��
|
876
|
+
|����t���ov��Y;P��Ҳ�����\�Tnx�����X�*ჿBG���E�\Ee�N������&�E�Ӕ�~��+�m�c��-!8��r2 �z��֥�]/�>[::���>���'���ʣs
|
877
|
+
3Ƿ'�5B�k�dx�����-ZQ�mE�m���������^�a i�3V1�ˁ��}�GkG���Y@*���ф��$BF�Yv���G��P��̂_��N�^ $�V�a(�kH�w�]�ަ���s�<S������y�*ɜ����lj������u1�9H���Չ�
|
878
|
+
��˓�ާ���%�m�6��"�ہ�9=s^s��֯m���ߗ�D�6���ybO�tz��l,�o��Q-���9��O��sY�})sV�u�K䞖魮�w�sOf�ே4��?�Λ������Ė��"��?6v����|��m����(�ך���n�W��?�����
|
879
|
+
�3�\�a1�O~�MZ��H��v����qS�
|
880
|
+
<�B+N���6tx��l�N{�ֺ���(@%J`p�IS��?7�>i\(��� (��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��L
|
881
|
+
Z(���z��@�����?5G�3^g,w�2�E{T��c��OY�O�`3��_=�e�O�S���LO'�-�.���Z�d���)Ԥ���z��)�I���j�������=t��~�$�����{���Y-���B��v�����*HR}
|
882
|
+
����F���i+^��k�GI{�KK��b�����2���
|
883
|
+
]r�-RHmoB����ܞճ��!�I�P�l�X��15�l���7�
|
884
|
+
��9#�N~�8����T �仒�.����t�b��H��J�y���n��j���PAl��N+�ot�}"?>peb���r����mݧ���fV��Bg�l�x�s�Wg���BU+�-�m��}���:0��6�H�l���S1�dۅ�T�~�
|
885
|
+
�2?��l�B����'~�gK#�t��UL�-˳�
|
886
|
+
��<�Q��B�Kk��3�^&;(�Kʖ��^Q��=KE�լfҵX�Kk��E#x#�
|
887
|
+
�M)_�W� ���m����Z�3�"��K�_&�Pf�-#n���d�_�t�,��٬�mā��=k��\�5Z�E�Q|2��_�����Y�}A��̪���N��G��}��k�`~�2���G�έk.��]��vN����;��-��0�s_�&��>x��ݐ�ƥ��7V�(IC�Jm8ی���s_�_��xŚq�|G����C�ĭˍ�@=��_�o�Y����?�T�4�\n|}3�/N�ʱ�Hl�%�F�I�p+����l=W�7����iғVV�Y�嫷��w�x�(c�n��W��[����t��7⎑���曢A)�$�؞y���m �$1nn㡯�/
|
888
|
+
�3�m<�����oi_����K��=������J^B��ځI�u�9�s�W��G�1Z]|D���yAmyPv�L�r�s�q��V�1��j�9fs�VSq�t��Z/#��w�֊�KݞO�j~&�7���X.mi�n�c8@���pI
|
889
|
+
}��|7��x��;w����w0S�J�;t�5������h��-�,Ϸ��9�ϥv����'+�v����P���^OY$�ջ��>s�q�oOѶϞ�φWVC����0O��@<W�h�
|
890
|
+
���z���`�m�H�H��d;���E{8>
|
891
|
+
(���ih�=h��(��(�����(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��*��� 9���*��EJq����Ӷ�}�����<��~u��pc�8�ӽzs*��e�i�L2�n ��cr9$�A��륉��<��;�hՓ�Q��Vlo� Q�*�q�zL�q�f�&�A�8ǡ�|����s+3�1�ծw��2w��R����@'��p�s��Rr��%�U��2}L����S6��ܖy��� �* $tɬ�xR�1���������(5T*�w��6[ۍٜ�S�
|
892
|
+
朩JJR���d5N��I��݉,-x��GM�;*��u0�c�`c��j�_�;�1Y7 ,���t=}�
|
893
|
+
�t��ޝz�*5霆RGҡ�I\�q$������.F1����Ty 1.�$ۏZ�&�*�S�|�WCI&v�xȫ��$��!zWMo�I$|��j߶Ҷ�&!�8oL�}I�r���S�.�he�9S��U�[Z+(g�+�b�Z�
|
894
|
+
;���9#�����cǯ]��(
|
895
|
+
(��
|
896
|
+
��o�Ҥ��b�u-:}=�x�Ѻ��0�A�Gj�����kr�lrjJ��%�hPh�q-Ѐ���$�=t�4�7������������m'�QE�!EP����(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��0(�4Q@uV��MƑ�8�Q�٣���)VV�ʌ�vg��d$Z��vcY��jdE�=x��zA������,�j���?S�b�%cɮ4��Y�D8�۵�[�����q˅��j����c�mQ����84��H�m�8��E���\-C����r>�3���S�&��dv9�ȼ9�@������g8���>A����3��3�&��eT��G嚝QT`
|
897
|
+
pt��S�NR1m��QEj ��(��(��(� �)h�t����Tg����
|
898
|
+
�C�=�k{%��.eKr���e���+��sx����i_u�O�_���i}J���;]m�*b��켧u��?1�9S�ga_�
|
899
|
+
Y}\������_Kjմ�����#�6�f'�OH)k��(������(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(��(����
|
900
|
+
endstream
|
901
|
+
endobj
|
902
|
+
7 0 obj
|
790
903
|
<< /Type /Font
|
791
904
|
/Subtype /Type1
|
792
905
|
/BaseFont /Helvetica
|
793
906
|
/Encoding /WinAnsiEncoding
|
794
907
|
>>
|
795
908
|
endobj
|
796
|
-
|
909
|
+
8 0 obj
|
797
910
|
<< /Type /Font
|
798
911
|
/Subtype /Type1
|
799
912
|
/BaseFont /Helvetica-Bold
|
800
913
|
/Encoding /WinAnsiEncoding
|
801
914
|
>>
|
802
915
|
endobj
|
803
|
-
|
916
|
+
9 0 obj
|
804
917
|
<< /Type /XObject
|
805
918
|
/Subtype /Image
|
806
919
|
/Height 75
|
807
920
|
/Width 142
|
808
921
|
/BitsPerComponent 8
|
809
922
|
/ColorSpace /DeviceRGB
|
810
|
-
/SMask
|
923
|
+
/SMask 10 0 R
|
811
924
|
/Length 5425
|
812
925
|
/Filter [/FlateDecode]
|
813
926
|
/DecodeParms [<< /Predictor 15
|
@@ -841,7 +954,7 @@ joIvvvP
|
|
841
954
|
�I�t�_@����S:���L�t�j8��뒥����)�r����Ո7��o��3���h
|
842
955
|
endstream
|
843
956
|
endobj
|
844
|
-
|
957
|
+
10 0 obj
|
845
958
|
<< /Type /XObject
|
846
959
|
/Subtype /Image
|
847
960
|
/Height 75
|
@@ -866,14 +979,14 @@ x
|
|
866
979
|
c��G��U�dt`v�3=`�}LG��AWn���[���O�O?������ۻ�w��A(�>�g�\:l����;�J�a�X_C:��6k���8�����z��WN2�/R���p��
|
867
980
|
endstream
|
868
981
|
endobj
|
869
|
-
|
982
|
+
11 0 obj
|
870
983
|
<< /Type /XObject
|
871
984
|
/Subtype /Image
|
872
985
|
/Height 142
|
873
986
|
/Width 141
|
874
987
|
/BitsPerComponent 8
|
875
988
|
/ColorSpace /DeviceRGB
|
876
|
-
/SMask
|
989
|
+
/SMask 12 0 R
|
877
990
|
/Length 9550
|
878
991
|
/Filter [/FlateDecode]
|
879
992
|
/DecodeParms [<< /Predictor 15
|
@@ -924,7 +1037,7 @@ q
|
|
924
1037
|
<YU*�%g��lV�{���ąD����q�|&h7{��m&���k����p���Mg�(V��d�uF����3�|��a�f0R)�g%H�_��Ch7[u�O��O���j�@����ȕG�<������E��v<A��S,��V���XΘ)&�He|���a��3e����)�
|
925
1038
|
endstream
|
926
1039
|
endobj
|
927
|
-
|
1040
|
+
12 0 obj
|
928
1041
|
<< /Type /XObject
|
929
1042
|
/Subtype /Image
|
930
1043
|
/Height 142
|
@@ -962,24 +1075,25 @@ y
|
|
962
1075
|
endstream
|
963
1076
|
endobj
|
964
1077
|
xref
|
965
|
-
0
|
1078
|
+
0 13
|
966
1079
|
0000000000 65535 f
|
967
1080
|
0000000015 00000 n
|
968
1081
|
0000000109 00000 n
|
969
1082
|
0000000158 00000 n
|
970
1083
|
0000000215 00000 n
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
1084
|
+
0000009422 00000 n
|
1085
|
+
0000009658 00000 n
|
1086
|
+
0000042340 00000 n
|
1087
|
+
0000042437 00000 n
|
1088
|
+
0000042539 00000 n
|
1089
|
+
0000048227 00000 n
|
1090
|
+
0000049174 00000 n
|
1091
|
+
0000058989 00000 n
|
978
1092
|
trailer
|
979
|
-
<< /Size
|
1093
|
+
<< /Size 13
|
980
1094
|
/Root 2 0 R
|
981
1095
|
/Info 1 0 R
|
982
1096
|
>>
|
983
1097
|
startxref
|
984
|
-
|
1098
|
+
63519
|
985
1099
|
%%EOF
|
Binary file
|
data/examples/complex_invoice.rb
CHANGED
@@ -55,10 +55,10 @@ module InvoicePrinter
|
|
55
55
|
@@labels = DEFAULT_LABELS.merge(labels)
|
56
56
|
end
|
57
57
|
|
58
|
-
def initialize(document: Document.new, labels: {}, font: nil, stamp: nil, logo: nil)
|
58
|
+
def initialize(document: Document.new, labels: {}, font: nil, stamp: nil, logo: nil, background: nil)
|
59
59
|
@document = document
|
60
60
|
@labels = PDFDocument.labels.merge(labels)
|
61
|
-
@pdf = Prawn::Document.new
|
61
|
+
@pdf = Prawn::Document.new(background: background)
|
62
62
|
@font = font
|
63
63
|
@stamp = stamp
|
64
64
|
@logo = logo
|
data/lib/invoice_printer.rb
CHANGED
@@ -54,13 +54,14 @@ module InvoicePrinter
|
|
54
54
|
# font - font file to use
|
55
55
|
# stamp - stamp & signature (image)
|
56
56
|
# logo - logotype (image)
|
57
|
-
def self.print(document:, file_name:, labels: {}, font: nil, stamp: nil, logo: nil)
|
57
|
+
def self.print(document:, file_name:, labels: {}, font: nil, stamp: nil, logo: nil, background: nil)
|
58
58
|
PDFDocument.new(
|
59
59
|
document: document,
|
60
60
|
labels: labels,
|
61
61
|
font: font,
|
62
62
|
stamp: stamp,
|
63
63
|
logo: logo,
|
64
|
+
background: background
|
64
65
|
).print(file_name)
|
65
66
|
end
|
66
67
|
|
@@ -71,13 +72,14 @@ module InvoicePrinter
|
|
71
72
|
# font - font file to use
|
72
73
|
# stamp - stamp & signature (image)
|
73
74
|
# logo - logotype (image)
|
74
|
-
def self.render(document:, labels: {}, font: nil, stamp: nil, logo: nil)
|
75
|
+
def self.render(document:, labels: {}, font: nil, stamp: nil, logo: nil, background: nil)
|
75
76
|
PDFDocument.new(
|
76
77
|
document: document,
|
77
78
|
labels: labels,
|
78
79
|
font: font,
|
79
80
|
stamp: stamp,
|
80
|
-
logo: logo
|
81
|
+
logo: logo,
|
82
|
+
background: background
|
81
83
|
).render
|
82
84
|
end
|
83
85
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class BackgroundTest < Minitest::Test
|
4
|
+
include InvoicePrinterHelpers
|
5
|
+
|
6
|
+
def setup
|
7
|
+
@invoice = InvoicePrinter::Document.new(default_document_params)
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_background_render
|
11
|
+
InvoicePrinter.render(document: @invoice, background: './examples/background.jpg')
|
12
|
+
InvoicePrinter.render(document: @invoice, background: nil)
|
13
|
+
InvoicePrinter.render(document: @invoice)
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_missing_background_raises_an_exception
|
17
|
+
assert_raises(ArgumentError) do
|
18
|
+
InvoicePrinter.render(document: @invoice, background: 'missing.jpg')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.8
|
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-09-
|
11
|
+
date: 2016-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -92,6 +92,7 @@ files:
|
|
92
92
|
- LICENSE.txt
|
93
93
|
- README.md
|
94
94
|
- Rakefile
|
95
|
+
- examples/background.jpg
|
95
96
|
- examples/complex_invoice.pdf
|
96
97
|
- examples/complex_invoice.png
|
97
98
|
- examples/complex_invoice.rb
|
@@ -109,6 +110,7 @@ files:
|
|
109
110
|
- lib/invoice_printer/document/item.rb
|
110
111
|
- lib/invoice_printer/pdf_document.rb
|
111
112
|
- lib/invoice_printer/version.rb
|
113
|
+
- test/background_test.rb
|
112
114
|
- test/dates_box_test.rb
|
113
115
|
- test/inputs_test.rb
|
114
116
|
- test/invoice_printer_test.rb
|
@@ -139,11 +141,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
141
|
version: '0'
|
140
142
|
requirements: []
|
141
143
|
rubyforge_project:
|
142
|
-
rubygems_version: 2.
|
144
|
+
rubygems_version: 2.4.8
|
143
145
|
signing_key:
|
144
146
|
specification_version: 4
|
145
147
|
summary: Super simple PDF invoicing in pure Ruby
|
146
148
|
test_files:
|
149
|
+
- test/background_test.rb
|
147
150
|
- test/dates_box_test.rb
|
148
151
|
- test/inputs_test.rb
|
149
152
|
- test/invoice_printer_test.rb
|