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 | ||
ecdaa8cd | 16 | switch(strtolower($_POST['print'])) { |
395c4f02 TM |
17 | case 'debug': case 'dbg': |
18 | break; | |
5a22a51f | 19 | case 'pdf': |
343fd015 | 20 | $convert='| ps2pdf -dCompatibility=1.2 - -'; |
5a22a51f TM |
21 | header('Content-Type: application/pdf'); |
22 | break; | |
23 | default: case 'ps': | |
24 | $convert=''; | |
25 | header('Content-Type: application/postscript'); | |
26 | header("Content-Disposition: attachment; filename=labels.ps"); | |
27 | break; | |
28 | } | |
29 | error_reporting(0); | |
395c4f02 TM |
30 | $cmd="barcode -e $enctype $geometry $table $barcodes $convert"; |
31 | if($_POST['print']=='Debug') die($cmd); | |
32 | system($cmd); | |
5a22a51f TM |
33 | die(); |
34 | } | |
35 | ?> | |
36 | <form action="?" method="POST"> | |
00370507 TM |
37 | <input type="number" name="cols" value="4" /> ↔ Sloupců<br /> |
38 | <input type="number" name="rows" value="13" /> ↕ Řádků<br /> | |
0472e63b | 39 | <input type="number" name="pages" value="1" /> ↵ Stran<br /> |
5a22a51f | 40 | <table> |
fcd9da73 | 41 | <tr><td></td><td><input type="number" name="top" value="20" /></td><td></td></tr> |
5ad14c31 | 42 | <tr><td><input type="number" name="left" value="2" /></td><td>Okraje</td><td><input type="number" name="right" value="1" /></td></tr> |
fcd9da73 | 43 | <tr><td></td><td><input type="number" name="bottom" value="25" /></td><td></td></tr> |
5a22a51f | 44 | </table> |
395c4f02 | 45 | <input type="submit" name="print" value="Debug" /> |
ecdaa8cd TM |
46 | <input type="submit" name="print" value="PS" /> |
47 | <input type="submit" name="print" value="PDF" /> | |
5a22a51f | 48 | </form> |
8ffb8610 | 49 | Pozor! Každý arch vytiskni jen jednou a radši ho hned po vytištění smaž! |