Last active
December 2, 2021 07:26
-
-
Save aspose-cloud/7dd7c6f477aeb4eabd1afc57e6913ccd to your computer and use it in GitHub Desktop.
This Gist repository contains code snippet related to Aspose.BarCode Cloud SDK for PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose.BarCode-Cloud-SDK-PHP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// For complete examples and data files, please go to https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-php/ | |
$request = new GetBarCodeGenerateRequest(EncodeBarcodeType::QR, 'PHP SDK Test'); | |
$request->format = 'png'; | |
$response = self::$api->GetBarCodeGenerate($request); | |
$imageSize = $response->getSize(); | |
$this->assertGreaterThan(0, $imageSize); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// For complete examples and data files, please go to https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-php/ | |
$request = new PutBarcodeGenerateFileRequest( | |
'PutBarcodeGenerateFile.png', | |
EncodeBarcodeType::CodablockF, | |
'Hello!' | |
); | |
$request->folder = self::$tempFolderPath; | |
$response = self::$api->putBarcodeGenerateFile($request); | |
$this->assertGreaterThan(0, $response->getFileSize()); | |
$this->assertGreaterThan(0, $response->getImageWidth()); | |
$this->assertGreaterThan(0, $response->getImageHeight()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// For complete examples and data files, please go to https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-php/ | |
$request = new GetBarCodeGenerateRequest(EncodeBarcodeType::QR, 'PHP SDK Test'); | |
$request->format = 'png'; | |
$response = self::$api->GetBarCodeGenerate($request); | |
if ($response != null) { | |
// Save response stream to a file | |
$fileName = 'D:/temp/GetBarcodeGenerate.png'; | |
$fh = fopen ( $fileName, 'w' ) or die ( 'cant open file' ); | |
fwrite ( $fh, $response ); | |
fclose ( $fh ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// For complete examples and data files, please go to https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-php/ | |
$request = new PutBarcodeGenerateFileRequest( | |
'PutBarcodeGenerateFile.png', | |
EncodeBarcodeType::Code128, | |
'Hello!' | |
); | |
$request->folder = self::$tempFolderPath; | |
$request->enable_checksum = 'Yes'; | |
$response = self::$api->putBarcodeGenerateFile($request); | |
$this->assertGreaterThan(0, $response->getFileSize()); | |
$this->assertGreaterThan(0, $response->getImageWidth()); | |
$this->assertGreaterThan(0, $response->getImageHeight()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// For complete examples and data files, please go to https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-php/ | |
$request = new PutGenerateMultipleRequest( | |
'PutGenerateMultiple.png', | |
new GeneratorParamsList([ | |
'barcode_builders' => [ | |
new GeneratorParams([ | |
'type_of_barcode' => EncodeBarcodeType::QR, | |
'text' => 'Hello QR!', | |
]), | |
new GeneratorParams([ | |
'type_of_barcode' => EncodeBarcodeType::Code128, | |
'text' => 'Hello Code128!', | |
]), | |
], | |
'x_step' => 0, | |
'y_step' => 0, | |
]) | |
); | |
$request->folder = self::$tempFolderPath; | |
$response = self::$api->putGenerateMultiple($request); | |
$this->assertGreaterThan(0, $response->getFileSize()); | |
$this->assertGreaterThan(0, $response->getImageWidth()); | |
$this->assertGreaterThan(0, $response->getImageHeight()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// For complete examples and data files, please go to https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-php/ | |
$request = new PutBarcodeGenerateFileRequest( | |
'PutBarcodeGenerateFile.png', | |
EncodeBarcodeType::Code128, | |
'Hello!' | |
); | |
$request->folder = self::$tempFolderPath; | |
$response = self::$api->putBarcodeGenerateFile($request); | |
$this->assertGreaterThan(0, $response->getFileSize()); | |
$this->assertGreaterThan(0, $response->getImageWidth()); | |
$this->assertGreaterThan(0, $response->getImageHeight()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// For complete examples and data files, please go to https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-php/ | |
$request = new PostBarCodeRecognizeFromUrlorContentRequest(); | |
$request->image = new SplFileObject('./data/pdf417Sample.png'); | |
$request->preset = PresetType::HighPerformance; | |
$response = self::$api->PostBarCodeRecognizeFromUrlorContent($request); | |
$barcodes = $response->getBarcodes(); | |
$this->assertCount(1, $barcodes); | |
$this->assertEquals(DecodeBarcodeType::Pdf417, $barcodes[0]->getType()); | |
$this->assertEquals('Aspose.BarCode for Cloud Sample', $barcodes[0]->getBarcodeValue()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// For complete examples and data files, please go to https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-php/ | |
$request = new PostBarCodeRecognizeFromUrlorContentRequest(); | |
$request->image = new SplFileObject('./data/pdf417Sample.png'); | |
$request->preset = PresetType::HighPerformance; | |
$response = self::$api->PostBarCodeRecognizeFromUrlorContent($request); | |
$barcodes = $response->getBarscodes(); | |
$this->assertCount(1, $barcodes); | |
$this->assertEquals(DecodeBarcodeType::Pdf417, $barcodes[0]->getType()); | |
$this->assertEquals('Aspose.BarCode for Cloud Sample', $barcodes[0]->getBarcodeValue()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// For complete examples and data files, please go to https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-php/ | |
$fileApi = new FileApi(null, self::$config); | |
$path = self::$tempFolderPath . '/' . 'GetBarcodeRecognize.png'; | |
$uploaded = $fileApi->uploadFile( | |
new UploadFileRequest( | |
$path, | |
new SplFileObject('./data/pdf417Sample.png') | |
) | |
); | |
$this->assertEmpty($uploaded->getErrors(), strval($uploaded)); | |
$request = new GetBarcodeRecognizeRequest($uploaded->getUploaded()[0]); | |
$request->folder = self::$tempFolderPath; | |
$request->rect_x = 10; | |
$request->rect_y = 10; | |
$request->rect_width = 200; | |
$request->rect_height = 200; | |
$request->checksum_validation = 'On' | |
$request->strip_fnc = true; | |
$response = self::$api->GetBarcoderecognize($request); | |
$barcodes = $response->getBarcodes(); | |
$this->assertCount(1, $barcodes); | |
$this->assertEquals(DecodeBarcodeType::Pdf417, $barcodes[0]->getType()); | |
$this->assertEquals('Aspose.BarCode for Cloud Sample', $barcodes[0]->getBarcodeValue()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// For complete examples and data files, please go to https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-php/ | |
$request = new PostBarCodeRecognizeFromUrlorContentRequest(); | |
$request->url = 'http://www.barcoding.com/images/Barcodes/pdf417.gif'; | |
$request->preset = PresetType::HighPerformance; | |
$response = self::$api->PostBarCodeRecognizeFromUrlorContent($request); | |
$barcodes = $response->getBarcodes(); | |
$this->assertCount(1, $barcodes); | |
$this->assertEquals(DecodeBarcodeType::Pdf417, $barcodes[0]->getType()); | |
$this->assertEquals('Aspose.BarCode for Cloud Sample', $barcodes[0]->getBarcodeValue()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// For complete examples and data files, please go to https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-php/ | |
$Imagefile = new SplFileObject('./data/pdf417Sample.png'); | |
$request = new PostBarCodeRecognizeFromUrlorContentRequest(); | |
$request->image = $Imagefile; | |
$request->preset = PresetType::HighPerformance; | |
$request->checksum_validation = 'On'; | |
$response = self::$api->PostBarCodeRecognizeFromUrlorContent($request); | |
$barcodes = $response->getBarcodes(); | |
$this->assertCount(1, $barcodes); | |
$this->assertEquals(DecodeBarcodeType::Pdf417, $barcodes[0]->getType()); | |
$this->assertEquals('Aspose.BarCode for Cloud Sample', $barcodes[0]->getBarcodeValue()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// For complete examples and data files, please go to https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-php/ | |
$fileApi = new FileApi(null, self::$config); | |
$path = self::$tempFolderPath . '/' . 'GetBarcodeRecognize.png'; | |
$uploaded = $fileApi->uploadFile( | |
new UploadFileRequest( | |
$path, | |
new SplFileObject('./data/pdf417Sample.png') | |
) | |
); | |
$this->assertEmpty($uploaded->getErrors(), strval($uploaded)); | |
$request = new GetBarcodeRecognizeRequest($uploaded->getUploaded()[0]); | |
$request->folder = self::$tempFolderPath; | |
$response = self::$api->GetBarcoderecognize($request); | |
$barcodes = $response->getBarcodes(); | |
$this->assertCount(1, $barcodes); | |
$this->assertEquals(DecodeBarcodeType::Pdf417, $barcodes[0]->getType()); | |
$this->assertEquals('Aspose.BarCode for Cloud Sample', $barcodes[0]->getBarcodeValue()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// For complete examples and data files, please go to https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-php/ | |
$request = new PutBarcodeGenerateFileRequest( | |
'PutBarcodeGenerateFile.png', | |
EncodeBarcodeType::Code128, | |
'Hello!' | |
); | |
$request->folder = self::$tempFolderPath; | |
$request->rotation_angle = 90; | |
$response = self::$api->putBarcodeGenerateFile($request); | |
$this->assertGreaterThan(0, $response->getFileSize()); | |
$this->assertGreaterThan(0, $response->getImageWidth()); | |
$this->assertGreaterThan(0, $response->getImageHeight()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// For complete examples and data files, please go to https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-php/ | |
$request = new PutBarcodeGenerateFileRequest( | |
'PutBarcodeGenerateFile.png', | |
EncodeBarcodeType::Code128, | |
'Hello!' | |
); | |
$request->folder = self::$tempFolderPath; | |
$request->bar_height = 50.0; | |
$response = self::$api->putBarcodeGenerateFile($request); | |
$this->assertGreaterThan(0, $response->getFileSize()); | |
$this->assertGreaterThan(0, $response->getImageWidth()); | |
$this->assertGreaterThan(0, $response->getImageHeight()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// For complete examples and data files, please go to https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-php/ | |
$request = new PutBarcodeGenerateFileRequest( | |
'PutBarcodeGenerateFile.png', | |
EncodeBarcodeType::Code128, | |
'Hello!' | |
); | |
$request->folder = self::$tempFolderPath; | |
$request->resolution = 200.0; | |
$response = self::$api->putBarcodeGenerateFile($request); | |
$this->assertGreaterThan(0, $response->getFileSize()); | |
$this->assertGreaterThan(0, $response->getImageWidth()); | |
$this->assertGreaterThan(0, $response->getImageHeight()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// For complete examples and data files, please go to https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-php/ | |
$request = new PutBarcodeGenerateFileRequest( | |
'PutBarcodeGenerateFile.png', | |
EncodeBarcodeType::Code128, | |
'Hello!' | |
); | |
$request->folder = self::$tempFolderPath; | |
$request->image_height = 1.0; | |
$request->image_width = 1.0; | |
$request->size_mode = 'None'; | |
$response = self::$api->putBarcodeGenerateFile($request); | |
$this->assertGreaterThan(0, $response->getFileSize()); | |
$this->assertGreaterThan(0, $response->getImageWidth()); | |
$this->assertGreaterThan(0, $response->getImageHeight()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// For complete examples and data files, please go to https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-php/ | |
$request = new PutBarcodeGenerateFileRequest( | |
'PutBarcodeGenerateFile.png', | |
EncodeBarcodeType::Code128, | |
'Hello!' | |
); | |
$request->folder = self::$tempFolderPath; | |
$request->dimension_x = 200.0; | |
$response = self::$api->putBarcodeGenerateFile($request); | |
$this->assertGreaterThan(0, $response->getFileSize()); | |
$this->assertGreaterThan(0, $response->getImageWidth()); | |
$this->assertGreaterThan(0, $response->getImageHeight()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// For complete examples and data files, please go to https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-php/ | |
$request = new PutBarcodeGenerateFileRequest( | |
'PutBarcodeGenerateFile.png', | |
EncodeBarcodeType::Code128, | |
'Hello!' | |
); | |
$request->folder = self::$tempFolderPath; | |
$request->format = 'png'; | |
$response = self::$api->putBarcodeGenerateFile($request); | |
$this->assertGreaterThan(0, $response->getFileSize()); | |
$this->assertGreaterThan(0, $response->getImageWidth()); | |
$this->assertGreaterThan(0, $response->getImageHeight()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// For complete examples and data files, please go to https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-php/ | |
$request = new PutBarcodeGenerateFileRequest( | |
'PutBarcodeGenerateFile.png', | |
EncodeBarcodeType::Code128, | |
'Hello!' | |
); | |
$request->folder = self::$tempFolderPath; | |
$request->text_location = 'Above'; | |
$response = self::$api->putBarcodeGenerateFile($request); | |
$this->assertGreaterThan(0, $response->getFileSize()); | |
$this->assertGreaterThan(0, $response->getImageWidth()); | |
$this->assertGreaterThan(0, $response->getImageHeight()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// For complete examples and data files, please go to https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-php/ | |
$request = new PutBarcodeGenerateFileRequest( | |
'PutBarcodeGenerateFile.png', | |
EncodeBarcodeType::Code128, | |
'Hello!' | |
); | |
$request->folder = self::$tempFolderPath; | |
$response = self::$api->putBarcodeGenerateFile($request); | |
$this->assertGreaterThan(0, $response->getFileSize()); | |
$this->assertGreaterThan(0, $response->getImageWidth()); | |
$this->assertGreaterThan(0, $response->getImageHeight()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment