Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
This documentation explains how to customize the appearance of barcodes using the Aspose.BarCode Cloud SDK for PHP. It provides details on the available methods, customization options, and examples of usage.
When generating a barcode, you can customize various aspects of its appearance using the properties of the request classes.
Key Properties:
QR, Aztec, Pdf417, Code39, etc).Png, Jpeg, Svg).AliceBlue or #FF000000).Below, Above, None).Pixel, Inch, Millimeter).In addition to the common appearance settings above, the API exposes advanced parameters that apply only to specific barcode types. They are ignored when a different barcode type is generated.
Auto, Extended, Binary, ECI).LevelL, LevelM, LevelQ, LevelH).Auto, Version01–Version40). Auto selects the smallest version that fits the data.UTF8, ISO_8859_1).0 to 1.Auto, M1–M4). Used when the barcode type is MicroQR.Auto, R7x43–R17x139). Used when the barcode type is RectMicroQR.Auto, CodeA, CodeB, CodeAB, CodeC, CodeAC, CodeBC).Auto, Binary, ECI, Extended).Level0–Level8).1–30, or 0 for auto).3–90, or 0 for automatic).2–5 for MicroPDF417; 3–5 for PDF417 and MacroPDF417).None, Macro05, Macro06).<?php
declare(strict_types=1);
require 'vendor/autoload.php';
use Aspose\BarCode\Configuration;
use Aspose\BarCode\GenerateApi;
use Aspose\BarCode\Model\{BarcodeImageFormat, BarcodeImageParams, CodeLocation, EncodeBarcodeType, QrParams, QREncodeMode, QRErrorLevel, QRVersion};
use Aspose\BarCode\Requests\GenerateRequestWrapper;
function makeConfiguration(): Configuration
{
$config = new Configuration();
$envToken = getenv("TEST_CONFIGURATION_ACCESS_TOKEN");
if (empty($envToken)) {
$config->setClientId("Client Id from https://dashboard.aspose.cloud/applications");
$config->setClientSecret("Client Secret from https://dashboard.aspose.cloud/applications");
} else {
$config->setAccessToken($envToken);
}
return $config;
}
function main(): void
{
$fileName = __DIR__ . "/../testdata/Qr.png";
$generateApi = new GenerateApi(null, makeConfiguration());
$request = new GenerateRequestWrapper(
EncodeBarcodeType::QR,
'Aspose.BarCode.Cloud'
);
$request->barcode_image_params = new BarcodeImageParams([
'image_format' => BarcodeImageFormat::Png,
'foreground_color' => 'Black',
'background_color' => 'White',
'text_location' => CodeLocation::Below,
'resolution' => 300,
'image_height' => 200,
'image_width' => 200
]);
$request->qr_params = new QrParams([
'qr_encode_mode' => QREncodeMode::Auto,
'qr_error_level' => QRErrorLevel::LevelM,
'qr_version' => QRVersion::Auto,
'qr_aspect_ratio' => 0.75
]);
$generated = $generateApi->generate($request);
file_put_contents($fileName, $generated->fread($generated->getSize()));
echo "File '{$fileName}' generated.\n";
}
main();
Result Image is: 
<?php
declare(strict_types=1);
require 'vendor/autoload.php';
use Aspose\BarCode\Configuration;
use Aspose\BarCode\GenerateApi;
use Aspose\BarCode\Model\{GenerateParams, EncodeBarcodeType, EncodeData, EncodeDataType, BarcodeImageParams, BarcodeImageFormat, QrParams, QREncodeMode, QRErrorLevel, QRVersion};
use Aspose\BarCode\Requests\GenerateBodyRequestWrapper;
function makeConfiguration(): Configuration
{
$config = new Configuration();
$envToken = getenv("TEST_CONFIGURATION_ACCESS_TOKEN");
if (empty($envToken)) {
$config->setClientId("Client Id from https://dashboard.aspose.cloud/applications");
$config->setClientSecret("Client Secret from https://dashboard.aspose.cloud/applications");
} else {
$config->setAccessToken($envToken);
}
return $config;
}
function main(): void
{
$fileName = __DIR__ . "/../testdata/QrCustom.jpeg";
$generateApi = new GenerateApi(null, makeConfiguration());
$generateParams = new GenerateParams([
'barcode_type' => EncodeBarcodeType::QR,
'encode_data' => new EncodeData([
'data' => 'Aspose',
'data_type' => EncodeDataType::StringData
]),
'barcode_image_params' => new BarcodeImageParams([
'foreground_color' => '#FF0000',
'background_color' => '#FFFF00',
'image_format' => BarcodeImageFormat::Jpeg,
'rotation_angle' => 90
]),
'qr_params' => new QrParams([
'qr_encode_mode' => QREncodeMode::Auto,
'qr_error_level' => QRErrorLevel::LevelM,
'qr_version' => QRVersion::Auto,
'qr_aspect_ratio' => 0.75
])
]);
$request = new GenerateBodyRequestWrapper($generateParams);
$generated = $generateApi->generateBody($request);
file_put_contents($fileName, $generated->fread($generated->getSize()));
echo "File '{$fileName}' generated.\n";
}
main();
Result Image is: 
<?php
declare(strict_types=1);
require 'vendor/autoload.php';
use Aspose\BarCode\Configuration;
use Aspose\BarCode\GenerateApi;
use Aspose\BarCode\Model\{BarcodeImageFormat, BarcodeImageParams, CodeLocation, Pdf417Params, Pdf417EncodeMode, Pdf417ErrorLevel};
use Aspose\BarCode\Requests\GenerateMultipartRequestWrapper;
use Aspose\BarCode\Model\EncodeBarcodeType;
function makeConfiguration(): Configuration
{
$config = new Configuration();
$envToken = getenv("TEST_CONFIGURATION_ACCESS_TOKEN");
if (empty($envToken)) {
$config->setClientId("Client Id from https://dashboard.aspose.cloud/applications");
$config->setClientSecret("Client Secret from https://dashboard.aspose.cloud/applications");
} else {
$config->setAccessToken($envToken);
}
return $config;
}
function main(): void
{
$fileName = __DIR__ . '/../testdata/Pdf417.svg';
$generateApi = new GenerateApi(null, makeConfiguration());
$request = new GenerateMultipartRequestWrapper(
EncodeBarcodeType::Pdf417,
"Aspose.BarCode.Cloud"
);
$request->barcode_image_params = new BarcodeImageParams([
'text_location' => CodeLocation::Above,
'image_format' => BarcodeImageFormat::Svg
]);
$request->pdf417_params = new Pdf417Params([
'pdf417_encode_mode' => Pdf417EncodeMode::Auto,
'pdf417_error_level' => Pdf417ErrorLevel::Level2,
'pdf417_aspect_ratio' => 3
]);
$barcodeStream = $generateApi->generateMultipart($request);
file_put_contents($fileName, $barcodeStream->fread($barcodeStream->getSize()));
echo "File '{$fileName}' generated.\n";
}
main();
Result Image is:
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.