b1978bad7be16e404aaccad802ac658db6a72f69
[mirrors/SokoMan.git] / assistants / print-labels.inc.php
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(strtolower($_POST['print'])) {
17 case 'pdf':
18 $convert='| ps2pdf -dCompatibility=1.2 - -';
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">
33 <input type="number" name="cols" value="4" /> &harr; Sloupců<br />
34 <input type="number" name="rows" value="13" /> &varr; Řádků<br />
35 <input type="number" name="pages" value="1" /> &crarr; Stran<br />
36 <table>
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>
40 </table>
41 <input type="submit" name="print" value="PS" />
42 <input type="submit" name="print" value="PDF" />
43 </form>
This page took 0.301431 seconds and 3 git commands to generate.