-
Notifications
You must be signed in to change notification settings - Fork 18
/
SetBarcodeImageBorders.php
40 lines (29 loc) · 1.09 KB
/
SetBarcodeImageBorders.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
namespace Aspose\Barcode\WorkingWithBarcodeImage\BarcodeImageBasicFeatures;
use com\aspose\barcode\BarCodeBuilder as BarCodeBuilder;
use com\aspose\barcode\MarginsF as MarginsF;
use java\awt\Color as Color;
class SetBarcodeImageBorders{
public static function run($dataDir=null){
# Instantiate barcode object
$bb = new BarCodeBuilder();
$margins = new MarginsF();
# 6 milimeter space from left, right, top and bottom side of border
$margins->setLeft(2);
$margins->setRight(2);
$margins->setTop(2);
$margins->setBottom(2);
# Set border's width to be 0.5 milimeter
$bb->setBorderWidth(0.5);
# Border will be visible
$bb->setBorderVisible(true);
# Set the border's color to red
$color=new Color();
$bb->setBorderColor($color->RED);
# Set margins
$bb->setMargins($margins);
$bb->save($dataDir . "border.jpg");
# Display Status.
print "Set border margins, please check the output file.".PHP_EOL;
}
}