Zend_Barcode-Renderers.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="zend.barcode.renderers">
  4. <title>Zend_Barcode Renderers</title>
  5. <para>
  6. Renderers have some common options. These options can be set in four ways:
  7. </para>
  8. <itemizedlist>
  9. <listitem>
  10. <para>
  11. As an array or a <classname>Zend_Config</classname> object passed to the
  12. constructor.
  13. </para>
  14. </listitem>
  15. <listitem>
  16. <para>
  17. As an array passed to the <methodname>setOptions()</methodname> method.
  18. </para>
  19. </listitem>
  20. <listitem>
  21. <para>
  22. As a <classname>Zend_Config</classname> object passed to the
  23. <methodname>setConfig()</methodname> method.
  24. </para>
  25. </listitem>
  26. <listitem>
  27. <para>As discrete values passed to individual setters.</para>
  28. </listitem>
  29. </itemizedlist>
  30. <example id="zend.barcode.renderers.configuration">
  31. <title>Different ways to parameterize a renderer object</title>
  32. <programlisting language="php"><![CDATA[
  33. $options = array('topOffset' => 10);
  34. // Case 1
  35. $renderer = new Zend_Barcode_Renderer_Pdf($options);
  36. // Case 2
  37. $renderer = new Zend_Barcode_Renderer_Pdf();
  38. $renderer->setOptions($options);
  39. // Case 3
  40. $config = new Zend_Config($options);
  41. $renderer = new Zend_Barcode_Renderer_Pdf();
  42. $renderer->setConfig($config);
  43. // Case 4
  44. $renderer = new Zend_Barcode_Renderer_Pdf();
  45. $renderer->setTopOffset(10);
  46. ]]></programlisting>
  47. </example>
  48. <sect2 id="zend.barcode.renderers.common.options">
  49. <title>Common Options</title>
  50. <para>
  51. In the following list, the values have no unit; we will use the term "unit." For
  52. example, the default value of the "thin bar" is "1 unit." The real units depend on the
  53. rendering support. The individual setters are obtained by uppercasing the initial
  54. letter of the option and prefixing the name with "set" (e.g. "barHeight" =>
  55. "setBarHeight"). All options have a correspondant getter prefixed with "get" (e.g.
  56. "getBarHeight"). Available options are:
  57. </para>
  58. <table id="zend.barcode.renderers.common.options.table">
  59. <title>Common Options</title>
  60. <tgroup cols="4">
  61. <thead>
  62. <row>
  63. <entry>Option</entry>
  64. <entry>Data Type</entry>
  65. <entry>Default Value</entry>
  66. <entry>Description</entry>
  67. </row>
  68. </thead>
  69. <tbody>
  70. <row>
  71. <entry><emphasis>rendererNamespace</emphasis></entry>
  72. <entry><type>String</type></entry>
  73. <entry><classname>Zend_Barcode_Renderer</classname></entry>
  74. <entry>
  75. Namespace of the renderer; for example, if you need to extend the
  76. renderers
  77. </entry>
  78. </row>
  79. <row>
  80. <entry><emphasis>horizontalPosition</emphasis></entry>
  81. <entry><type>String</type></entry>
  82. <entry>"left"</entry>
  83. <entry>
  84. Can be "left", "center" or "right". Can be useful with
  85. <acronym>PDF</acronym> or if the <methodname>setWidth()</methodname>
  86. method is used with an image renderer.
  87. </entry>
  88. </row>
  89. <row>
  90. <entry><emphasis>verticalPosition</emphasis></entry>
  91. <entry><type>String</type></entry>
  92. <entry>"top"</entry>
  93. <entry>
  94. Can be "top", "middle" or "bottom". Can be useful with
  95. <acronym>PDF</acronym> or if the <methodname>setHeight()</methodname>
  96. method is used with an image renderer.
  97. </entry>
  98. </row>
  99. <row>
  100. <entry><emphasis>leftOffset</emphasis></entry>
  101. <entry><type>Integer</type></entry>
  102. <entry>0</entry>
  103. <entry>
  104. Top position of the barcode inside the renderer. If used, this value
  105. will override the "horizontalPosition" option.
  106. </entry>
  107. </row>
  108. <row>
  109. <entry><emphasis>topOffset</emphasis></entry>
  110. <entry><type>Integer</type></entry>
  111. <entry>0</entry>
  112. <entry>
  113. Top position of the barcode inside the renderer. If used, this value
  114. will override the "verticalPosition" option.
  115. </entry>
  116. </row>
  117. <row>
  118. <entry><emphasis>automaticRenderError</emphasis></entry>
  119. <entry><type>Boolean</type></entry>
  120. <entry><constant>TRUE</constant></entry>
  121. <entry>
  122. Whether or not to automatically render errors. If an exception occurs,
  123. the provided barcode object will be replaced with an Error
  124. representation. Note that some errors (or exceptions) can not be
  125. rendered.
  126. </entry>
  127. </row>
  128. <row>
  129. <entry><emphasis>moduleSize</emphasis></entry>
  130. <entry><type>Float</type></entry>
  131. <entry>1</entry>
  132. <entry>Size of a rendering module in the support.</entry>
  133. </row>
  134. <row>
  135. <entry><emphasis>barcode</emphasis></entry>
  136. <entry><classname>Zend_Barcode_Object</classname></entry>
  137. <entry><constant>NULL</constant></entry>
  138. <entry>The barcode object to render.</entry>
  139. </row>
  140. </tbody>
  141. </tgroup>
  142. </table>
  143. <para>
  144. An additional getter exists: <methodname>getType()</methodname>. It returns the name of
  145. the renderer class without the namespace (e.g.
  146. <classname>Zend_Barcode_Renderer_Image</classname> returns "image").
  147. </para>
  148. </sect2>
  149. <sect2 id="zend.barcode.renderers.image">
  150. <title>Zend_Barcode_Renderer_Image</title>
  151. <para>
  152. The Image renderer will draw the instruction list of the barcode object in an image
  153. resource. The component requires the GD extension.
  154. The default width of a module is 1 pixel.
  155. </para>
  156. <para>Available option are:</para>
  157. <table id="zend.barcode.renderers.image.table">
  158. <title>Zend_Barcode_Renderer_Image Options</title>
  159. <tgroup cols="4">
  160. <thead>
  161. <row>
  162. <entry>Option</entry>
  163. <entry>Data Type</entry>
  164. <entry>Default Value</entry>
  165. <entry>Description</entry>
  166. </row>
  167. </thead>
  168. <tbody>
  169. <row>
  170. <entry><emphasis>height</emphasis></entry>
  171. <entry><type>Integer</type></entry>
  172. <entry>0</entry>
  173. <entry>
  174. Allow you to specify the height of the result image. If "0",
  175. the height will be calculated by the barcode object.
  176. </entry>
  177. </row>
  178. <row>
  179. <entry><emphasis>width</emphasis></entry>
  180. <entry><type>Integer</type></entry>
  181. <entry>0</entry>
  182. <entry>
  183. Allow you to specify the width of the result image. If "0",
  184. the width will be calculated by the barcode object.
  185. </entry>
  186. </row>
  187. <row>
  188. <entry><emphasis>imageType</emphasis></entry>
  189. <entry><type>String</type></entry>
  190. <entry>"png"</entry>
  191. <entry>
  192. Specify the image format. Can be "png", "jpeg", "jpg" or "gif".
  193. </entry>
  194. </row>
  195. </tbody>
  196. </tgroup>
  197. </table>
  198. </sect2>
  199. <sect2 id="zend.barcode.renderers.pdf">
  200. <title>Zend_Barcode_Renderer_Pdf</title>
  201. <para>
  202. The <acronym>PDF</acronym> renderer will draw the instruction list of the barcode
  203. object in a <acronym>PDF</acronym> document.
  204. The default width of a module is 0.5 point.
  205. </para>
  206. <para>
  207. There are no particular options for this renderer.
  208. </para>
  209. </sect2>
  210. <sect2 id="zend.barcode.renderers.svg">
  211. <title>Zend_Barcode_Renderer_Svg</title>
  212. <para>
  213. The <acronym>SVG</acronym> renderer will draw the instruction list of the barcode
  214. object in a <acronym>SVG</acronym> document.
  215. The default width of a module is 1 pixel.
  216. </para>
  217. <para>Available option are:</para>
  218. <table id="zend.barcode.renderers.svg.table">
  219. <title>Zend_Barcode_Renderer_Svg Options</title>
  220. <tgroup cols="4">
  221. <thead>
  222. <row>
  223. <entry>Option</entry>
  224. <entry>Data Type</entry>
  225. <entry>Default Value</entry>
  226. <entry>Description</entry>
  227. </row>
  228. </thead>
  229. <tbody>
  230. <row>
  231. <entry><emphasis>height</emphasis></entry>
  232. <entry><type>Integer</type></entry>
  233. <entry>0</entry>
  234. <entry>
  235. Allow you to specify the height of the result image. If "0",
  236. the height will be calculated by the barcode object.
  237. </entry>
  238. </row>
  239. <row>
  240. <entry><emphasis>width</emphasis></entry>
  241. <entry><type>Integer</type></entry>
  242. <entry>0</entry>
  243. <entry>
  244. Allow you to specify the width of the result image. If "0",
  245. the width will be calculated by the barcode object.
  246. </entry>
  247. </row>
  248. </tbody>
  249. </tgroup>
  250. </table>
  251. </sect2>
  252. </sect1>