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
|
<?xml version="1.0" encoding="UTF-8"?>
<!-- Reviewed: no -->
<sect1 id="zend.barcode.renderers">
<title>Zend_Barcode Renderers</title>
<para>
Renderers have some common options. 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>As discrete values passed to individual setters.</para>
</listitem>
</itemizedlist>
<example id="zend.barcode.renderers.configuration">
<title>Different ways to parameterize a renderer object</title>
<programlisting language="php"><![CDATA[
$options = array('topOffset' => 10);
// Case 1
$renderer = new Zend_Barcode_Renderer_Pdf($options);
// Case 2
$renderer = new Zend_Barcode_Renderer_Pdf();
$renderer->setOptions($options);
// Case 3
$config = new Zend_Config($options);
$renderer = new Zend_Barcode_Renderer_Pdf();
$renderer->setConfig($config);
// Case 4
$renderer = new Zend_Barcode_Renderer_Pdf();
$renderer->setTopOffset(10);
]]></programlisting>
</example>
<sect2 id="zend.barcode.renderers.common.options">
<title>Common Options</title>
<para>
In the following list, the values have no unit; 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. The individual setters are obtained by uppercasing the initial
letter of the option and prefixing the name with "set" (e.g. "barHeight" =>
"setBarHeight"). All options have a correspondant getter prefixed with "get" (e.g.
"getBarHeight"). Available options are:
</para>
<table id="zend.barcode.renderers.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>rendererNamespace</emphasis></entry>
<entry><type>String</type></entry>
<entry><classname>Zend_Barcode_Renderer</classname></entry>
<entry>
Namespace of the renderer; for example, if you need to extend the
renderers
</entry>
</row>
<row>
<entry><emphasis>horizontalPosition</emphasis></entry>
<entry><type>String</type></entry>
<entry>"left"</entry>
<entry>
Can be "left", "center" or "right". Can be useful with
<acronym>PDF</acronym> or if the <methodname>setWidth()</methodname>
method is used with an image renderer.
</entry>
</row>
<row>
<entry><emphasis>verticalPosition</emphasis></entry>
<entry><type>String</type></entry>
<entry>"top"</entry>
<entry>
Can be "top", "middle" or "bottom". Can be useful with
<acronym>PDF</acronym> or if the <methodname>setHeight()</methodname>
method is used with an image renderer.
</entry>
</row>
<row>
<entry><emphasis>leftOffset</emphasis></entry>
<entry><type>Integer</type></entry>
<entry>0</entry>
<entry>
Top position of the barcode inside the renderer. If used, this value
will override the "horizontalPosition" option.
</entry>
</row>
<row>
<entry><emphasis>topOffset</emphasis></entry>
<entry><type>Integer</type></entry>
<entry>0</entry>
<entry>
Top position of the barcode inside the renderer. If used, this value
will override the "verticalPosition" option.
</entry>
</row>
<row>
<entry><emphasis>automaticRenderError</emphasis></entry>
<entry><type>Boolean</type></entry>
<entry><constant>TRUE</constant></entry>
<entry>
Whether or not to automatically render errors. If an exception occurs,
the provided barcode object will be replaced with an Error
representation. Note that some errors (or exceptions) can not be
rendered.
</entry>
</row>
<row>
<entry><emphasis>moduleSize</emphasis></entry>
<entry><type>Float</type></entry>
<entry>1</entry>
<entry>Size of a rendering module in the support.</entry>
</row>
<row>
<entry><emphasis>barcode</emphasis></entry>
<entry><classname>Zend_Barcode_Object</classname></entry>
<entry><constant>NULL</constant></entry>
<entry>The barcode object to render.</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
An additional getter exists: <methodname>getType()</methodname>. It returns the name of
the renderer class without the namespace (e.g.
<classname>Zend_Barcode_Renderer_Image</classname> returns "image").
</para>
</sect2>
<sect2 id="zend.barcode.renderers.image">
<title>Zend_Barcode_Renderer_Image</title>
<para>
The Image renderer will draw the instruction list of the barcode object in an image
resource. The component requires the GD extension.
The default width of a module is 1 pixel.
</para>
<para>Available option are:</para>
<table id="zend.barcode.renderers.image.table">
<title>Zend_Barcode_Renderer_Image 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>height</emphasis></entry>
<entry><type>Integer</type></entry>
<entry>0</entry>
<entry>
Allow you to specify the height of the result image. If "0",
the height will be calculated by the barcode object.
</entry>
</row>
<row>
<entry><emphasis>width</emphasis></entry>
<entry><type>Integer</type></entry>
<entry>0</entry>
<entry>
Allow you to specify the width of the result image. If "0",
the width will be calculated by the barcode object.
</entry>
</row>
<row>
<entry><emphasis>imageType</emphasis></entry>
<entry><type>String</type></entry>
<entry>"png"</entry>
<entry>
Specify the image format. Can be "png", "jpeg", "jpg" or "gif".
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect2>
<sect2 id="zend.barcode.renderers.pdf">
<title>Zend_Barcode_Renderer_Pdf</title>
<para>
The <acronym>PDF</acronym> renderer will draw the instruction list of the barcode
object in a <acronym>PDF</acronym> document.
The default width of a module is 0.5 point.
</para>
<para>
There are no particular options for this renderer.
</para>
</sect2>
<sect2 id="zend.barcode.renderers.svg">
<title>Zend_Barcode_Renderer_Svg</title>
<para>
The <acronym>SVG</acronym> renderer will draw the instruction list of the barcode
object in a <acronym>SVG</acronym> document.
The default width of a module is 1 pixel.
</para>
<para>Available option are:</para>
<table id="zend.barcode.renderers.svg.table">
<title>Zend_Barcode_Renderer_Svg 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>height</emphasis></entry>
<entry><type>Integer</type></entry>
<entry>0</entry>
<entry>
Allow you to specify the height of the result image. If "0",
the height will be calculated by the barcode object.
</entry>
</row>
<row>
<entry><emphasis>width</emphasis></entry>
<entry><type>Integer</type></entry>
<entry>0</entry>
<entry>
Allow you to specify the width of the result image. If "0",
the width will be calculated by the barcode object.
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect2>
</sect1>
|