1. Go to this page and download the library: Download aspose/barcode library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
aspose / barcode example snippets
public function barcodeReaderExample()
{
$license = new License();
$license->setLicense(TestsAssist::PHP_LICENSE_PATH);
$image_path = TestsAssist::TESTDATA_ROOT . "Recognition/1D/Code39/code39.gif";
$reader = new BarCodeReader($image_path, null, null);
$reader->getBarcodeSettings()->setChecksumValidation(ChecksumValidation::ON);
$foundBarCodes = $reader->readBarCodes();
$foundCount = $reader->getFoundCount();
print("Count of found barcodes: ". $foundCount.PHP_EOL);
print("CodeText " . $foundBarCodes[0]->getCodeText().PHP_EOL);
print("CodeType " . $foundBarCodes[0]->getCodeType().PHP_EOL);
print("CodeType " . $foundBarCodes[0]->getCodeTypeName().PHP_EOL);
}
public function readAndGenerateExample()
{
$license = new License();
$license->setLicense(TestsAssist::PHP_LICENSE_PATH);
$codeText = "12345678";
$encodeType = EncodeTypes::CODE_11;
$generator = new BarcodeGenerator($encodeType, $codeText);
$base64Image = $generator->generateBarCodeImage(BarCodeImageFormat::PNG);
$reader = new BarCodeReader($base64Image, null, null);
$resultsArray = $reader->readBarCodes();
$barCodeResult = $resultsArray[0];
$codeText = $barCodeResult->getCodeText();
$codeType = $barCodeResult->getCodeTypeName();
print("codeText " . $codeText);
print("codeType " . $codeType);
}
batch
@echo off
:: Get the directory where this script is located
set SCRIPT_DIR=%~dp0
:: Define the path to the JAR file relative to this script
set JAR_PATH=%SCRIPT_DIR%vendor\aspose\barcode-php\lib\aspose-barcode-php-thrift-25.5.jar
:: Define the log file path (optional)
set LOG_FILE=%SCRIPT_DIR%server.log
echo Starting Thrift server...
start /B java -jar "%JAR_PATH%"
echo Thrift server started! Logs are in %LOG_FILE%.
exit
bash
#!/bin/bash
# Get the directory where this script is located
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Define the path to the JAR file relative to this script
JAR_PATH="$SCRIPT_DIR/vendor/aspose/barcode-php/lib/aspose-barcode-php-thrift-25.5.jar"
# Define the log file path (optional)
LOG_FILE="$SCRIPT_DIR/server.log"
echo "Starting Thrift server..."
nohup java -jar "$JAR_PATH" > "$LOG_FILE" 2>&1 &
echo "Thrift server started! Logs are in $LOG_FILE."
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.