format_cards.lib.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <?php
  2. /* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
  3. * Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  4. * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. * or see http://www.gnu.org/
  19. */
  20. /**
  21. * \file htdocs/core/lib/format_cards.lib.php
  22. * \brief Set of functions used for cards generation
  23. * \ingroup core
  24. */
  25. global $_Avery_Labels;
  26. // Unit of metric are defined into field 'metric' in mm.
  27. // To get into inch, just /25.4
  28. // Size of pages available on: http://www.worldlabel.com/Pages/pageaverylabels.htm
  29. // _PosX = marginLeft+(_COUNTX*(width+SpaceX));
  30. $_Avery_Labels = array (
  31. '5160'=>array('name'=>'Avery-5160, WL-875WX',
  32. 'paper-size'=>'letter',
  33. 'metric'=>'mm',
  34. 'marginLeft'=>5.58165, // 0.21975 inch
  35. 'marginTop'=>12.7, // 0.5 inch
  36. 'NX'=>3,
  37. 'NY'=>10,
  38. 'SpaceX'=>3.556, // 0.14 inch
  39. 'SpaceY'=>0,
  40. 'width'=>65.8749, // 2.59350 inch
  41. 'height'=>25.4, // 1 inch
  42. 'font-size'=>7),
  43. '5161'=>array('name'=>'Avery-5161, WL-75WX',
  44. 'paper-size'=>'letter',
  45. 'metric'=>'mm',
  46. 'marginLeft'=>4.445, // 0.175 inch
  47. 'marginTop'=>12.7,
  48. 'NX'=>2,
  49. 'NY'=>10,
  50. 'SpaceX'=>3.968, // 0.15625 inch
  51. 'SpaceY'=>0,
  52. 'width'=>101.6, // 4 inch
  53. 'height'=>25.4, // 1 inch
  54. 'font-size'=>7),
  55. '5162'=>array('name'=>'Avery-5162, WL-100WX',
  56. 'paper-size'=>'letter',
  57. 'metric'=>'mm',
  58. 'marginLeft'=>3.8735, // 0.1525 inch
  59. 'marginTop'=>22.352, // 0.88 inch
  60. 'NX'=>2,
  61. 'NY'=>7,
  62. 'SpaceX'=>4.954, // 0.195 inch
  63. 'SpaceY'=>0,
  64. 'width'=>101.6, // 4 inch
  65. 'height'=>33.781, // 1.33 inch
  66. 'font-size'=>8),
  67. '5163'=>array('name'=>'Avery-5163, WL-125WX',
  68. 'paper-size'=>'letter',
  69. 'metric'=>'mm',
  70. 'marginLeft'=>4.572, // 0.18 inch
  71. 'marginTop'=>12.7, // 0.5 inch
  72. 'NX'=>2,
  73. 'NY'=>5,
  74. 'SpaceX'=>3.556, // 0.14 inch
  75. 'SpaceY'=>0,
  76. 'width'=>101.6, // 4 inch
  77. 'height'=>50.8, // 2 inch
  78. 'font-size'=>10),
  79. /* Bugged '5164'=>array('name'=>'5164 (Letter)',
  80. 'paper-size'=>'letter',
  81. 'metric'=>'in',
  82. 'marginLeft'=>0.148,
  83. 'marginTop'=>0.5,
  84. 'NX'=>2,
  85. 'NY'=>3,
  86. 'SpaceX'=>0.2031,
  87. 'SpaceY'=>0,
  88. 'width'=>4.0,
  89. 'height'=>3.33,
  90. 'font-size'=>12), */
  91. '8600'=>array('name'=>'Avery-8600',
  92. 'paper-size'=>'letter',
  93. 'metric'=>'mm',
  94. 'marginLeft'=>7.1,
  95. 'marginTop'=>19,
  96. 'NX'=>3,
  97. 'NY'=>10,
  98. 'SpaceX'=>9.5,
  99. 'SpaceY'=>3.1,
  100. 'width'=>66.6,
  101. 'height'=>25.4,
  102. 'font-size'=>7),
  103. 'L7163'=>array('name'=>'Avery-L7163',
  104. 'paper-size'=>'A4',
  105. 'metric'=>'mm',
  106. 'marginLeft'=>5,
  107. 'marginTop'=>15,
  108. 'NX'=>2,
  109. 'NY'=>7,
  110. 'SpaceX'=>25,
  111. 'SpaceY'=>0,
  112. 'width'=>99.1,
  113. 'height'=>38.1,
  114. 'font-size'=>8),
  115. // 85.0 x 54.0 mm
  116. 'AVERYC32010'=>array('name'=>'Avery-C32010',
  117. 'paper-size'=>'A4',
  118. 'metric'=>'mm',
  119. 'marginLeft'=>15,
  120. 'marginTop'=>13,
  121. 'NX'=>2,
  122. 'NY'=>5,
  123. 'SpaceX'=>10,
  124. 'SpaceY'=>0,
  125. 'width'=>85,
  126. 'height'=>54,
  127. 'font-size'=>10),
  128. 'CARD'=>array('name'=>'Dolibarr Business cards',
  129. 'paper-size'=>'A4',
  130. 'metric'=>'mm',
  131. 'marginLeft'=>15,
  132. 'marginTop'=>15,
  133. 'NX'=>2,
  134. 'NY'=>5,
  135. 'SpaceX'=>0,
  136. 'SpaceY'=>0,
  137. 'width'=>85,
  138. 'height'=>54,
  139. 'font-size'=>10)
  140. );
  141. foreach($_Avery_Labels as $key => $val)
  142. {
  143. $_Avery_Labels[$key]['name'].=' ('.$_Avery_Labels[$key]['paper-size'].' - '.$_Avery_Labels[$key]['NX'].'x'.$_Avery_Labels[$key]['NY'].')';
  144. }