BarcodePro Web API for Docker generates barcode images that can be used from Any Development Platform and Programming Languages (.NET, Java, PHP, Javascript, Python, Ruby, and more!). After specifying a Value to encode, choosing a Barcode Symbology, and setting some simple properties, BarcodePro Web API will generate the barcode symbol in the specified image or document format like JPEG/JPG, PNG, PCX, SVG, EPS, and PDF!
ArtModuleShape
and ArtFinderShape
properties allow you to customize the QR Code modules and finders!
Designed by following some of the REST principles, BarcodePro Web API for Docker responds to a simple HTTP POST by specifying the Barcode settings through a JSON object in the request body, returning the output rendering in the image or document format specified through the Accept header.
BarcodePro Web API for Docker is available at Docker Hub registry.
To pull/download the Docker image, please type the following from a Terminal:
AMDTo run the Docker image, please type the following from a Terminal:
AMDBy default, our Docker image exposes ports 80
and 443
only. If you want to expose and use another different port, then do the following.
12345
. Create a new Dockerfile and edit it by pasting the following content:
FROM neodynamic/barcodeprowebapi:3.0.11
EXPOSE 12345
The following source code invokes the BarcodePro Web API for Docker to generate a PNG image for the specified Barcode JSON object (in this simple example we'll request a QRCode encoding 12345). For more advanced settings please refer to the Barcode JSON Object
curl -X POST "http://localhost:8080/BarcodeGenerator" \
-H "Accept: image/png" \
-H "Content-Type: application/json" \
-d "{\"symbology\":\"QRCode\", \"code\":\"12345\"}" \
--output label.png
$data = array(
'symbology' => 'QRCode',
'code' => '12345'
);
$options = array(
'http' => array(
'method' => 'POST',
'content' => json_encode( $data ),
'header' => "Content-Type: application/json\r\n" .
"Accept: image/png\r\n"
)
);
$context = stream_context_create( $options );
$url = 'http://localhost:8080/BarcodeGenerator';
$response = file_get_contents( $url, false, $context );
file_put_contents('label.png', $response);
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse("http://localhost:8080/BarcodeGenerator")
header = {'Accept':'image/png', 'Content-Type': 'application/json'}
data = {symbology: 'QRCode', code: '12345'}
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.request_uri, header)
request.body = data.to_json
response = http.request(request)
open('/tmp/label.png', 'wb' ) { |file|
file.write(response.body)
}
import requests
import json
url = "http://localhost:8080/BarcodeGenerator"
jsondata = json.dumps( {"symbology": "QRCode", "code": "12345"} )
headers = {
'content-type': "application/json",
'accept': "image/png"
}
response = requests.request("POST", url, data=jsondata, headers=headers)
if response.status_code == 200:
with open("label.png", 'wb') as f:
f.write(response.content)
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
my $server_endpoint = "http://localhost:8080/BarcodeGenerator";
my $req = HTTP::Request->new(POST => $server_endpoint);
$req->header('content-type' => 'application/json');
$req->header('accept' => 'image/png');
my $post_data = '{ "symbology" : "QRCode", "code" : "12345" }';
$req->content($post_data);
my $resp = $ua->request($req);
open FILEHANDLE, ">label.png";
print FILEHANDLE $resp->{_content};
close FILEHANDLE;
CloseableHttpClient client = HttpClients.createDefault();
HttpPost httpPost = new HttpPost("http://localhost:8080/BarcodeGenerator");
String json = "{\"symbology\" : \"QRCode\", \"code\": \"12345\"}";
StringEntity entity = new StringEntity(json);
httpPost.setEntity(entity);
httpPost.setHeader("Accept", "image/png");
httpPost.setHeader("Content-type", "application/json");
CloseableHttpResponse response = client.execute(httpPost);
HttpEntity entity = response.getEntity();
if (entity != null) {
try (FileOutputStream outstream = new FileOutputStream(new File("label.png"))) {
entity.writeTo(outstream);
}
}
client.close();
string DATA = "{\"symbology\" : \"QRCode\", \"code\": \"12345\"}";
var request = (HttpWebRequest)WebRequest.Create("http://localhost:8080/BarcodeGenerator");
request.Method = "POST";
request.ContentType = "application/json";
request.ContentLength = DATA.Length;
request.Accept = "image/png";
using (var requestWriter = new StreamWriter(request.GetRequestStream(), System.Text.Encoding.ASCII)){
requestWriter.Write(DATA);
}
var webResponse = request.GetResponse();
using (var stream = webResponse.GetResponseStream())
using (var fileStream = File.OpenWrite("label.png"))
{
var bytes = new byte[4096];
var read=0;
do
{
if (stream == null) {continue;}
read = stream.Read(bytes, 0, bytes.Length);
fileStream.Write(bytes, 0, read);
} while (read != 0);
}
var data = JSON.stringify({
"symbology": "QRCode",
"code": "12345"
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "http://localhost:8080/BarcodeGenerator");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("accept", "image/png");
xhr.send(data);
var request = require('request');
var headers = {
'Accept': 'image/png',
'Content-Type': 'application/json'
}
var options = {
url: 'http://localhost:8080/BarcodeGenerator',
method: 'POST',
headers: headers,
json: {"symbology": "QRCode", "code": "12345"}
}
request(options, function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
}
})
The desired output rendering format must be specified through the Accept header. The supported formats are the following:
Accept | Description |
---|---|
image/png |
Returns the generated barcode symbol in PNG format. |
image/jpeg |
Returns the generated barcode symbol in JPEG/JPG format. |
application/pdf |
Returns generated barcode symbol as a single PDF document. |
application/postscript |
Returns generated barcode symbol in EPS format. Requires a license key... |
image/svg+xml |
Returns generated barcode symbol in SVG format. Requires a license key... |
image/vnd.zbrush.pcx |
Returns the generated barcode symbol in PCX format. |
BarcodePro Web API is licensed for Private On-Premise environments giving you full control on the infrastructure where our product will run on. Please refer to Licensing model and prices...
When you buy a commercial license of BarcodePro Web API for Docker, you are provided with license information (LicenseOwner & LicenseKey) to register the product. The license information must be specified to the Docker image as environment variables as folows:
AMDThe Trial Version of BarcodePro Web API for Docker is fully functional and has no expiry date. However, while in TRIAL mode, the output rendering has the following limitations:
2024-05-13
2024-04-24
2023-10-31
2023-10-26
2023-07-26
2023-02-27
2023-02-22
2023-02-07
2023-01-11
2022-08-09
2022-07-13
2022-04-29
QRCodeMask
property to specify the desired mask patternArtModuleShape
and ArtFinderShape
properties. These allow to create artistic QR Codes like Google Chrome and other patterns like Rect, RoundRect, Dot, Circle, ZebraHorizontal, ZebraVertical, and Diamond!2022-03-10
2022-02-07
2021-11-25
2021-10-25
2021-06-02
2021-05-03
2021-03-04
/health
2020-10-31
2020-04-24
2020-04-20