Exception.php 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @package Zend_Pdf
  16. * @subpackage Core
  17. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  18. * @license http://framework.zend.com/license/new-bsd New BSD License
  19. */
  20. /** Zend_Exception */
  21. require_once 'Zend/Exception.php';
  22. /**
  23. * Exception class for Zend_Pdf.
  24. *
  25. * If you expect a certain type of exception to be caught and handled by the
  26. * caller, create a constant for it here and include it in the object being
  27. * thrown. Example:
  28. *
  29. * throw new Zend_Pdf_Exception('foo() is not yet implemented',
  30. * Zend_Pdf_Exception::NOT_IMPLEMENTED);
  31. *
  32. * This allows the caller to determine the specific type of exception that was
  33. * thrown without resorting to parsing the descriptive text.
  34. *
  35. * IMPORTANT: Do not rely on numeric values of the constants! They are grouped
  36. * sequentially below for organizational purposes only. The numbers may come to
  37. * mean something in the future, but they are subject to renumbering at any
  38. * time. ALWAYS use the symbolic constant names, which are guaranteed never to
  39. * change, in logical checks! You have been warned.
  40. *
  41. * @package Zend_Pdf
  42. * @subpackage Core
  43. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  44. * @license http://framework.zend.com/license/new-bsd New BSD License
  45. */
  46. class Zend_Pdf_Exception extends Zend_Exception
  47. {
  48. /**** Class Constants ****/
  49. /* Generic Exceptions */
  50. /**
  51. * The feature or option is planned but has not yet been implemented. It
  52. * should be available in a future revision of the framework.
  53. */
  54. const NOT_IMPLEMENTED = 0x0001;
  55. /**
  56. * The feature or option has been deprecated and will be removed in a future
  57. * revision of the framework. The descriptive text accompanying this
  58. * exception should explain how to use the replacement features or options.
  59. */
  60. const DEPRECATED = 0x0002;
  61. /**
  62. * Not enough paramaters were supplied to the method.
  63. */
  64. const TOO_FEW_PARAMETERS = 0x0003;
  65. /**
  66. * A parameter was of the wrong data type.
  67. */
  68. const BAD_PARAMETER_TYPE = 0x0004;
  69. /**
  70. * A parameter contained an unusable value.
  71. */
  72. const BAD_PARAMETER_VALUE = 0x0005;
  73. /**
  74. * A parameter value was not within the expected range.
  75. */
  76. const PARAMETER_VALUE_OUT_OF_RANGE = 0x0006;
  77. /**
  78. * The method that has multiple signatures could not understand the
  79. * number and/or types of parameters.
  80. */
  81. const BAD_METHOD_SIGNATURE = 0x0007;
  82. /**
  83. * An array or string index was out of range.
  84. */
  85. const INDEX_OUT_OF_RANGE = 0x0008;
  86. /* Filesystem I/O */
  87. /**
  88. * The file path was unusable or invalid.
  89. */
  90. const BAD_FILE_PATH = 0x0101;
  91. /**
  92. * The file is not readable by the current user.
  93. */
  94. const NOT_READABLE = 0x0102;
  95. /**
  96. * The file is not writeable by the current user.
  97. */
  98. const NOT_WRITEABLE = 0x0103;
  99. /**
  100. * The file resource has been closed unexpectedly.
  101. */
  102. const FILE_NOT_OPEN = 0x0104;
  103. /**
  104. * An error was encountered while attempting to open the file.
  105. */
  106. const CANT_OPEN_FILE = 0x0105;
  107. /**
  108. * An error was encountered while attempting to obtain the current file
  109. * position.
  110. */
  111. const CANT_GET_FILE_POSITION = 0x0106;
  112. /**
  113. * An error was encountered while attempting to set a new file position.
  114. */
  115. const CANT_SET_FILE_POSITION = 0x0107;
  116. /**
  117. * An attempt was made to move the current file position before the start
  118. * of the file.
  119. */
  120. const MOVE_BEFORE_START_OF_FILE = 0x0108;
  121. /**
  122. * An attempt was made to move the current file position beyond the end of
  123. * the file.
  124. */
  125. const MOVE_BEYOND_END_OF_FILE = 0x0109;
  126. /**
  127. * An error was encountered while attempting to obtain the file size.
  128. */
  129. const CANT_GET_FILE_SIZE = 0x010a;
  130. /**
  131. * An error was encountered while attempting to read data from the file.
  132. */
  133. const ERROR_DURING_READ = 0x010b;
  134. /**
  135. * An error was encountered while attempting to write data to the file.
  136. */
  137. const ERROR_DURING_WRITE = 0x010c;
  138. /**
  139. * An incompatible page size was specified for a buffered read operation.
  140. */
  141. const INVALID_PAGE_SIZE = 0x010d;
  142. /**
  143. * There is insufficient data to fulfill the read request.
  144. */
  145. const INSUFFICIENT_DATA = 0x010e;
  146. /* Zend_Pdf_FileParser */
  147. /**
  148. * The file parser data source object was invalid or improperly initialized.
  149. */
  150. const BAD_DATA_SOURCE = 0x0201;
  151. /**
  152. * An unknown byte order was specified.
  153. */
  154. const INVALID_BYTE_ORDER = 0x0202;
  155. /**
  156. * An invalid integer size was specified.
  157. */
  158. const INVALID_INTEGER_SIZE = 0x0203;
  159. /**
  160. * An invalid fixed-point number size was specified.
  161. */
  162. const BAD_FIXED_POINT_SIZE = 0x0204;
  163. /**
  164. * The string cannot be read.
  165. */
  166. const CANT_READ_STRING = 0x0205;
  167. /**
  168. * This file type must be parsed in a specific order and a parsing method
  169. * was called out-of-turn.
  170. */
  171. const PARSED_OUT_OF_ORDER = 0x0206;
  172. /* Zend_Pdf_FileParser_Font and Subclasses */
  173. /**
  174. * The font file type is incorrect.
  175. */
  176. const WRONG_FONT_TYPE = 0x0301;
  177. /**
  178. * The number of tables contained in the font is outside the expected range.
  179. */
  180. const BAD_TABLE_COUNT = 0x0302;
  181. /**
  182. * A required table was not present in the font.
  183. */
  184. const REQUIRED_TABLE_NOT_FOUND = 0x0303;
  185. /**
  186. * The parser does not understand this version of this table in the font.
  187. */
  188. const DONT_UNDERSTAND_TABLE_VERSION = 0x0303;
  189. /**
  190. * The magic number in the font file is incorrect.
  191. */
  192. const BAD_MAGIC_NUMBER = 0x0304;
  193. /**
  194. * Could not locate a usable character map for this font.
  195. */
  196. const CANT_FIND_GOOD_CMAP = 0x0305;
  197. /* Zend_Pdf_Cmap and Subclasses */
  198. /**
  199. * The character map type is currently unsupported.
  200. */
  201. const CMAP_TYPE_UNSUPPORTED = 0x0401;
  202. /**
  203. * The type of the character map is not understood.
  204. */
  205. const CMAP_UNKNOWN_TYPE = 0x0402;
  206. /**
  207. * The character map table data is too small.
  208. */
  209. const CMAP_TABLE_DATA_TOO_SMALL = 0x0403;
  210. /**
  211. * The character map table data is for a different type of table.
  212. */
  213. const CMAP_WRONG_TABLE_TYPE = 0x0404;
  214. /**
  215. * The character map table data contains in incorrect length.
  216. */
  217. const CMAP_WRONG_TABLE_LENGTH = 0x0405;
  218. /**
  219. * This character map table is language-dependent. Character maps must be
  220. * language-independent.
  221. */
  222. const CMAP_NOT_LANGUAGE_INDEPENDENT = 0x0406;
  223. /**
  224. * The final byte offset when reading the character map table data does not
  225. * match the reported length of the table.
  226. */
  227. const CMAP_FINAL_OFFSET_NOT_LENGTH = 0x0407;
  228. /**
  229. * The character map subtable entry count does not match the expected value.
  230. */
  231. const CMAP_WRONG_ENTRY_COUNT = 0x0408;
  232. /* Zend_Pdf_Resource_Font and Subclasses */
  233. /**
  234. * The specified glyph number is out of range for this font.
  235. */
  236. const GLYPH_OUT_OF_RANGE = 0x0501;
  237. /**
  238. * This font program has copyright bits set which prevent it from being
  239. * embedded in the PDF file. You must specify the no-embed option to use
  240. * this font.
  241. */
  242. const FONT_CANT_BE_EMBEDDED = 0x0502;
  243. /* Zend_Pdf_Font */
  244. /**
  245. * The font name did not match any previously instantiated font and is not
  246. * one of the standard 14 PDF fonts.
  247. */
  248. const BAD_FONT_NAME = 0x0601;
  249. /**
  250. * The factory method could not determine the type of the font file.
  251. */
  252. const CANT_DETERMINE_FONT_TYPE = 0x0602;
  253. /* Text Layout System */
  254. /**
  255. * The specified attribute value for the text object cannot be used.
  256. */
  257. const BAD_ATTRIBUTE_VALUE = 0x0701;
  258. /* Zend_Pdf_Image and Subclasses */
  259. const CANT_DETERMINE_IMAGE_TYPE = 0x0801;
  260. const WRONG_IMAGE_TYPE = 0x0802;
  261. const UNSUPPORTED_IMAGE_ENCODING_OPTIONS = 0x0803;
  262. const IMAGE_FILE_CORRUPT = 0x0804;
  263. }