Public Function Search_edit () {
Including all required classes
Require_once (' D:\wamp64\www\aier\Public\Admin\barcodegen\class\BCGFontFile.php ');
Require_once (' D:\wamp64\www\aier\Public\Admin\barcodegen\class\BCGColor.php ');
Require_once (' D:\wamp64\www\aier\Public\Admin\barcodegen\class\BCGDrawing.php ');
$codebar = BCGcode39; Barcode will be the content of the data
Including the barcode technology
Require_once (' D:\wamp64\www\aier\Public\Admin\barcodegen\class\barcode.php ');
Loading Font
$font = new Bcgfontfile ('./font/arial.ttf ', 12);
The arguments is R, G, B for color.
$color _black = new Bcgcolor (0, 0, 0);
$color _white = new Bcgcolor (255, 255, 255);
$drawException = null;
try {
$code = new $codebar ();//instantiate the corresponding encoding format
$code->setscale (2); Resolution
$code->setthickness (23); Thickness
$code->setforegroundcolor ($color _black); Color of bars
$code->setbackgroundcolor ($color _white); Color of spaces
$code->setfont ($font); Font (or 0)
$text = ' dfdf '; Barcode will be the content of the data
$code->parse ($text);
} catch (Exception $exception) {
$drawException = $exception;
}
/* Here is the list of the arguments
1-filename (Empty:display on screen)
2-background Color */
$drawing = new Bcgdrawing (", $color _white);
if ($drawException) {
$drawing->drawexception ($drawException);
} else {
$drawing->setbarcode ($code);
$drawing->draw ();
}
Header that says it's an image (remove it if you save the barcode to a file)
Header (' content-type:image/png ');
Draw (or save) the image into PNG format.
$drawing->finish (bcgdrawing::img_format_png);
}
Error:
Class ' admin\controller\bcgfontfile ' not found
Require was successful, but the variables in the require could not be found and could not be used.
Reply to discussion (solution)
Give it a try
$font = new \bcgfontfile ('./font/arial.ttf ', 12);
All of the following file classes you introduce, add a \
Give it a try
$font = new \bcgfontfile ('./font/arial.ttf ', 12);
All of the following file classes you introduce, add a \
Sure is useful, thank you!