File: Zend_Barcode-Objects.xml

package info (click to toggle)
zendframework 1.12.9%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 133,584 kB
  • sloc: xml: 1,311,829; php: 570,173; sh: 170; makefile: 125; sql: 121
file content (384 lines) | stat: -rw-r--r-- 15,065 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
<?xml version="1.0" encoding="UTF-8"?>
<!-- Reviewed: no -->
<sect1 id="zend.barcode.objects" xmlns:xi="http://www.w3.org/2001/XInclude">
    <title>Zend_Barcode Objects</title>

    <para>
        Barcode objects allow you to generate barcodes independently of the rendering support. After
        generation, you can retrieve the barcode as an array of drawing instructions that you can
        provide to a renderer.
    </para>

    <para>
        Objects have a large number of options. Most of them are common to all objects. These
        options can be set in four ways:
    </para>

    <itemizedlist>
        <listitem>
            <para>
                As an array or a <classname>Zend_Config</classname> object passed to the
                constructor.
            </para>
        </listitem>

        <listitem>
            <para>
                As an array passed to the <methodname>setOptions()</methodname> method.
            </para>
        </listitem>

        <listitem>
            <para>
                As a <classname>Zend_Config</classname> object passed to the
                <methodname>setConfig()</methodname> method.
            </para>
        </listitem>

        <listitem>
            <para>Via individual setters for each configuration type.</para>
        </listitem>
    </itemizedlist>

    <example id="zend.barcode.objects.configuration">
        <title>Different ways to parameterize a barcode object</title>

        <programlisting language="php"><![CDATA[
$options = array('text' => 'ZEND-FRAMEWORK', 'barHeight' => 40);

// Case 1: constructor
$barcode = new Zend_Barcode_Object_Code39($options);

// Case 2: setOptions()
$barcode = new Zend_Barcode_Object_Code39();
$barcode->setOptions($options);

// Case 3: setConfig()
$config  = new Zend_Config($options);
$barcode = new Zend_Barcode_Object_Code39();
$barcode->setConfig($config);

// Case 4: individual setters
$barcode = new Zend_Barcode_Object_Code39();
$barcode->setText('ZEND-FRAMEWORK')
        ->setBarHeight(40);
]]></programlisting>
    </example>

    <sect2 id="zend.barcode.objects.common.options">
        <title>Common Options</title>

        <para>
            In the following list, the values have no units; we will use the term "unit." For
            example, the default value of the "thin bar" is "1 unit". The real units depend on the
            rendering support (see <link linkend="zend.barcode.renderers">the renderers
                documentation</link> for more information). Setters are each named by uppercasing
            the initial letter of the option and prefixing the name with "set" (e.g. "barHeight"
            becomes "setBarHeight"). All options have a corresponding getter prefixed with "get"
            (e.g. "getBarHeight"). Available options are:
        </para>

        <table id="zend.barcode.objects.common.options.table">
            <title>Common Options</title>

            <tgroup cols="4">
                <thead>
                    <row>
                        <entry>Option</entry>
                        <entry>Data Type</entry>
                        <entry>Default Value</entry>
                        <entry>Description</entry>
                    </row>
                </thead>

                <tbody>
                    <row>
                        <entry><emphasis>barcodeNamespace</emphasis></entry>
                        <entry><type>String</type></entry>
                        <entry><classname>Zend_Barcode_Object</classname></entry>

                        <entry>
                            Namespace of the barcode; for example, if you need to extend the
                            embedding objects
                        </entry>
                    </row>

                    <row>
                        <entry><emphasis>barHeight</emphasis></entry>
                        <entry><type>Integer</type></entry>
                        <entry>50</entry>
                        <entry>Height of the bars</entry>
                    </row>
                    <row>
                        <entry><emphasis>barThickWidth</emphasis></entry>
                        <entry><type>Integer</type></entry>
                        <entry>3</entry>
                        <entry>Width of the thick bar</entry>
                    </row>

                    <row>
                        <entry><emphasis>barThinWidth</emphasis></entry>
                        <entry><type>Integer</type></entry>
                        <entry>1</entry>
                        <entry>Width of the thin</entry>
                    </row>

                    <row>
                        <entry><emphasis>factor</emphasis></entry>
                        <entry><type>Integer</type></entry>
                        <entry>1</entry>
                        <entry>Factor by which to multiply bar widths and font sizes</entry>
                    </row>

                    <row>
                        <entry><emphasis>foreColor</emphasis></entry>
                        <entry><type>Integer</type></entry>
                        <entry>0 (black)</entry>

                        <entry>
                            Color of the bar and the text. Could be provided as an integer
                            or as a <acronym>HTML</acronym> value (e.g. "#333333")
                        </entry>
                    </row>

                    <row>
                        <entry><emphasis>backgroundColor</emphasis></entry>
                        <entry><type>Integer</type> or <type>String</type></entry>
                        <entry>16777125 (white)</entry>

                        <entry>
                            Color of the background. Could be provided as an integer
                            or as a <acronym>HTML</acronym> value (e.g. "#333333")
                        </entry>
                    </row>

                    <row>
                        <entry><emphasis>reverseColor</emphasis></entry>
                        <entry><type>Boolean</type></entry>
                        <entry><constant>FALSE</constant></entry>
                        <entry>Allow switching the color of the bar and the background</entry>
                    </row>

                    <row>
                        <entry><emphasis>orientation</emphasis></entry>
                        <entry><type>Integer</type></entry>
                        <entry>0</entry>
                        <entry>Orientation of the barcode</entry>
                    </row>

                    <row>
                        <entry><emphasis>font</emphasis></entry>
                        <entry><type>String</type> or <type>Integer</type></entry>
                        <entry><constant>NULL</constant></entry>

                        <entry>
                            Font path to a <acronym>TTF</acronym> font or a number between 1 and 5
                            if using image generation with GD (internal fonts)
                        </entry>
                    </row>

                    <row>
                        <entry><emphasis>fontSize</emphasis></entry>
                        <entry><type>Integer</type></entry>
                        <entry>10</entry>
                        <entry>Size of the font (not applicable with numeric fonts)</entry>
                    </row>

                    <row>
                        <entry><emphasis>withBorder</emphasis></entry>
                        <entry><type>Boolean</type></entry>
                        <entry><constant>FALSE</constant></entry>
                        <entry>Draw a border around the barcode and the quiet zones</entry>
                    </row>

                    <row>
                        <entry><emphasis>withQuietZones</emphasis></entry>
                        <entry><type>Boolean</type></entry>
                        <entry><constant>TRUE</constant></entry>
                        <entry>Leave a quiet zone before and after the barcode</entry>
                    </row>

                    <row>
                        <entry><emphasis>drawText</emphasis></entry>
                        <entry><type>Boolean</type></entry>
                        <entry><constant>TRUE</constant></entry>
                        <entry>Set if the text is displayed below the barcode</entry>
                    </row>

                    <row>
                        <entry><emphasis>stretchText</emphasis></entry>
                        <entry><type>Boolean</type></entry>
                        <entry><constant>FALSE</constant></entry>
                        <entry>Specify if the text is stretched all along the barcode</entry>
                    </row>

                    <row>
                        <entry><emphasis>withChecksum</emphasis></entry>
                        <entry><type>Boolean</type></entry>
                        <entry><constant>FALSE</constant></entry>

                        <entry>
                            Indicate whether or not the checksum is automatically added to
                            the barcode
                        </entry>
                    </row>

                    <row>
                        <entry><emphasis>withChecksumInText</emphasis></entry>
                        <entry><type>Boolean</type></entry>
                        <entry><constant>FALSE</constant></entry>

                        <entry>
                            Indicate whether or not the checksum is displayed in the textual
                            representation
                        </entry>
                    </row>

                    <row>
                        <entry><emphasis>text</emphasis></entry>
                        <entry><type>String</type></entry>
                        <entry><constant>NULL</constant></entry>
                        <entry>The text to represent as a barcode</entry>
                    </row>
                </tbody>
            </tgroup>
        </table>

        <sect3 id="zend.barcode.objects.common.options.barcodefont">
            <title>Particular case of static setBarcodeFont()</title>

            <para>
                You can set a commont font for all your objects by using the static method
                <methodname>Zend_Barcode_Object::setBarcodeFont()</methodname>. This value
                can be always be overridden for individual objects by using the
                <methodname>setFont()</methodname> method.
            </para>

            <programlisting language="php"><![CDATA[
// In your bootstrap:
Zend_Barcode_Object::setBarcodeFont('my_font.ttf');

// Later in your code:
Zend_Barcode::render(
    'code39',
    'pdf',
    array('text' => 'ZEND-FRAMEWORK')
); // will use 'my_font.ttf'

// or:
Zend_Barcode::render(
    'code39',
    'image',
    array(
        'text' => 'ZEND-FRAMEWORK',
        'font' => 3
    )
); // will use the 3rd GD internal font
]]></programlisting>
        </sect3>
    </sect2>

    <sect2 id="zend.barcode.objects.common.getters">
        <title>Common Additional Getters</title>

        <para></para>

        <table id="zend.barcode.objects.common.getters.table">
            <title>Common Getters</title>

            <tgroup cols="3">
                <thead>
                    <row>
                        <entry>Getter</entry>
                        <entry>Data Type</entry>
                        <entry>Description</entry>
                    </row>
                </thead>

                <tbody>
                    <row>
                        <entry><methodname>getType()</methodname></entry>
                        <entry><type>String</type></entry>

                        <entry>
                            Return the name of the barcode class without the namespace (e.g.
                            <classname>Zend_Barcode_Object_Code39</classname> returns simply
                            "code39")
                        </entry>
                    </row>

                    <row>
                        <entry><methodname>getRawText()</methodname></entry>
                        <entry><type>String</type></entry>
                        <entry>Return the original text provided to the object</entry>
                    </row>

                    <row>
                        <entry><methodname>getTextToDisplay()</methodname></entry>
                        <entry><type>String</type></entry>

                        <entry>
                            Return the text to display, including, if activated, the checksum value
                        </entry>
                    </row>

                    <row>
                        <entry><methodname>getQuietZone()</methodname></entry>
                        <entry><type>Integer</type></entry>

                        <entry>
                            Return the size of the space needed before and after the barcode
                            without any drawing
                        </entry>
                    </row>

                    <row>
                        <entry><methodname>getInstructions()</methodname></entry>
                        <entry><type>Array</type></entry>
                        <entry>Return drawing instructions as an array.</entry>
                    </row>

                    <row>
                        <entry><methodname>getHeight($recalculate = false)</methodname></entry>
                        <entry><type>Integer</type></entry>

                        <entry>
                            Return the height of the barcode calculated after possible rotation
                        </entry>
                    </row>

                    <row>
                        <entry><methodname>getWidth($recalculate = false)</methodname></entry>
                        <entry><type>Integer</type></entry>

                        <entry>
                            Return the width of the barcode calculated after possible rotation
                        </entry>
                    </row>

                    <row>
                        <entry><methodname>getOffsetTop($recalculate = false)</methodname></entry>
                        <entry><type>Integer</type></entry>

                        <entry>
                            Return the position of the top of the barcode calculated after
                            possible rotation
                        </entry>
                    </row>

                    <row>
                        <entry><methodname>getOffsetLeft($recalculate = false)</methodname></entry>
                        <entry><type>Integer</type></entry>

                        <entry>
                            Return the position of the left of the barcode calculated after
                            possible rotation
                        </entry>
                    </row>
                </tbody>
            </tgroup>
        </table>
    </sect2>

    <xi:include href="Zend_Barcode-Objects_Details.xml" />
</sect1>