Commit | Line | Data |
---|---|---|
5a22a51f TM |
1 | <?php |
2 | if(isset($_POST['print'])) { | |
3 | $prefix = time().'SPOJE'; | |
4 | $enctype = 'code128b'; | |
5 | $geometry = ''; | |
6 | $count = $_POST['cols']*$_POST['rows']*$_POST['pages']; | |
7 | ||
8 | $table = '-p A4 -t '.escapeshellarg( | |
9 | $_POST['cols'].'x'.$_POST['rows']. | |
10 | '+'.$_POST['left'].'+'.$_POST['bottom'].'-'.$_POST['right'].'-'.$_POST['top'] | |
11 | ); | |
12 | ||
13 | $barcodes = ''; | |
14 | for($i=0;$i<$count;$i++) $barcodes.=' -b '.escapeshellarg($prefix.$i); | |
15 | ||
16 | switch($_POST['print']) { | |
17 | case 'pdf': | |
343fd015 | 18 | $convert='| ps2pdf -dCompatibility=1.2 - -'; |
5a22a51f TM |
19 | header('Content-Type: application/pdf'); |
20 | break; | |
21 | default: case 'ps': | |
22 | $convert=''; | |
23 | header('Content-Type: application/postscript'); | |
24 | header("Content-Disposition: attachment; filename=labels.ps"); | |
25 | break; | |
26 | } | |
27 | error_reporting(0); | |
28 | system("barcode -e $enctype $geometry $table $barcodes $convert"); | |
29 | die(); | |
30 | } | |
31 | ?> | |
32 | <form action="?" method="POST"> | |
00370507 TM |
33 | <input type="number" name="cols" value="4" /> ↔ Sloupců<br /> |
34 | <input type="number" name="rows" value="13" /> ↕ Řádků<br /> | |
0472e63b | 35 | <input type="number" name="pages" value="1" /> ↵ Stran<br /> |
5a22a51f | 36 | <table> |
5ad14c31 TM |
37 | <tr><td></td><td><input type="number" name="top" value="25" /></td><td></td></tr> |
38 | <tr><td><input type="number" name="left" value="2" /></td><td>Okraje</td><td><input type="number" name="right" value="1" /></td></tr> | |
39 | <tr><td></td><td><input type="number" name="bottom" value="20" /></td><td></td></tr> | |
5a22a51f TM |
40 | </table> |
41 | <input type="submit" name="print" value="ps" /> | |
42 | <input type="submit" name="print" value="pdf" /> | |
43 | </form> |