Denda Vivas

PDF-ZPL

API URL:

                            

Method:POST

https://pdf-zpl.denda.ro/api/v1/pdf-to-zpl/convert/<<Api KEY>>

Parameters:

  • url_pdfpdf file source <<https://exemple.com/file.pdf>>.
    *only https otherwise the error <<"code": "ERR_INVALID_PROTOCOL">> will appear
  • width & height → specify the exact dimensions of the zpl code, to allow fitting in different formats (A4,A6...).,
    *only numerical values
  • horizontalSpace → horizontal placement of the content *only numerical values
  • verticalSpace → vertical placement of the content *only numerical values
                            

'Content-Type': 'application/json' { "url_pdf" : "https://exemple.com/file.pdf", "width" : 800, "height" : 1100, "horizontalSpace" : 25, "verticalSpace" : 45 }

Code snippet:

                                let  header = new Headers();
                                header.append("Content-Type", "application/json");
                                
let data = JSON.stringify({ "url_pdf": "https://exemple.com/file.pdf", "width": 800, "height": 1100, "horizontalSpace": 25, "verticalSpace": 45 });
let options = { method: 'POST', headers: header, body: data, redirect: 'follow' };
fetch("https://pdf-zpl.denda.ro/api/v1/pdf-to-zpl/convert/<<APY KEY>>", options) .then(response => response.json()) .then(result => console.log(result)) .catch(error => console.log('error', error));
                                const axios = require('axios');
                                
let data = JSON.stringify({ "url_pdf": "https://exemple.com/file.pdf", "width": 800, "height": 1100, "horizontalSpace": 25, "verticalSpace": 45 });
let config = { method: 'post', url:"https://pdf-zpl.denda.ro/api/v1/pdf-to-zpl/convert/<<APY KEY>>", headers: { 'Content-Type': 'application/json' }, data : data };
axios(config) .then(function (response) { console.log(JSON.stringify(response.data)); })
.catch(function (error) { console.log(error); });
                                <?php
                                
$curl = curl_init();
curl_setopt_array($curl, array( CURLOPT_URL => 'https://pdf-zpl.denda.ro/api/v1/pdf-to-zpl/convert/<<APY KEY>>', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, URLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{ "url_pdf":"https://exemple.com/file.pdf", "width":800, "height":1100, "horizontalSpace": 25, "verticalSpace": 45 }',
CURLOPT_HTTPHEADER => array( 'Content-Type: application/json' ), ));
$response = curl_exec($curl);
curl_close($curl); echo $response;
                                    let settings = {
                                    "url": "https://pdf-zpl.denda.ro/api/v1/pdf-to-zpl/convert/<<APY KEY>>",
                                    "method": "POST",
                                    "timeout": 0,
                                    "headers": {
                                    "Content-Type": "application/json"
                                    },
                                    
                                    
"data": JSON.stringify({ "url_pdf": "https://exemple.com/file.pdf", "width": 800, "height": 1100, "horizontalSpace": 25, "verticalSpace": 45 }), }
$.ajax(settings).done(function (response) { console.log(response); });

Response:

Appears when all functions are executed without problem.

                            {
                                "status":"success",
                                "message":"Itelligent PDF-ZPL Convertor - Print",
                                "ip":"IP Adress",
                                "port":"Port",
                                "zpl":"ZPL CODE",
                                "response":{{printer response}}
                            }
                        

Occurs when the site's URL is invalid or does not contain that file.

                            {
                                "status":"failed",
                                "message":"url invalid"
                            }
                        

Appears when the specified api key is not identified in the database.

                                {
                                    "status":"failed",
                                    "message":"Invalid Api Key"
                                }
                        

It can be caused by the incorrect saving of the pdf.

                            {
                                "status":'failed',
                                "message":'failed to extract data from pdf',
                                "error":((error))
                            }
                        

It may be caused by an error in the conversion:

                                    {
                                    "status":'failed'
                                    "message":'failed to convert  pdf to zpl',
                                    "error":((error))
                                    }
                            

API URL:

                            

Method:POST

https://pdf-zpl.denda.ro/api/v1/pdf-to-zpl/print/<<Api KEY>>

Parameters:

  • ipthe ip address of the router.
  • port the specific printer port.
  • zpl → zpl code.
                            

'Content-Type': 'application/json' { "ip" : "127.0.0.1", "port " : 5000, "zpl" : "^XA^FDHello World^XZ~PS" }

Code snippet:

                                let  header = new Headers();
                                header.append("Content-Type", "application/json");
                                
let data = JSON.stringify({ "ip": "127.0.0.1", "port": 5000, "zpl": "^XA^FDHello World^XZ~PS" });
let options = { method: 'POST', headers: header, body: data, redirect: 'follow' };
fetch("https://pdf-zpl.denda.ro/api/v1/pdf-to-zpl/print/<<APY KEY>>", options) .then(response => response.json()) .then(result => console.log(result)) .catch(error => console.log('error', error));
                                const axios = require('axios');
                                
let data = JSON.stringify({ "ip": "127.0.0.1", "port": 5000, "zpl": "^XA^FDHello World^XZ~PS" });
let config = { method: 'post', url:"https://pdf-zpl.denda.ro/api/v1/pdf-to-zpl/print/<<APY KEY>>", headers: { 'Content-Type': 'application/json' }, data : data };
axios(config) .then(function (response) { console.log(JSON.stringify(response.data)); })
.catch(function (error) { console.log(error); });
                                <?php
                                
$curl = curl_init();
curl_setopt_array($curl, array( CURLOPT_URL => 'https://pdf-zpl.denda.ro/api/v1/pdf-to-zpl/print/<<APY KEY>>', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, URLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{ "ip":"127.0.0.1", "port":5000, "zpl":"^XA^FDHello World^XZ~PS" }',
CURLOPT_HTTPHEADER => array( 'Content-Type: application/json' ), ));
$response = curl_exec($curl);
curl_close($curl); echo $response;
                                    let settings = {
                                    "url": "https://pdf-zpl.denda.ro/api/v1/pdf-to-zpl/print/<<APY KEY>>",
                                    "method": "POST",
                                    "timeout": 0,
                                    "headers": {
                                    "Content-Type": "application/json"
                                    },
                                    
                                    
"data": JSON.stringify({ "ip": "127.0.0.1", "port": 5000, "zpl": "^XA^FDHello World^XZ~PS" }), }
$.ajax(settings).done(function (response) { console.log(response); });

Response:

Appears when all functions are executed without problem.

                                {
                                    "status":"success",
                                    "message":"Itelligent PDF-ZPL Convertor - successful printing.",
                                    "ip":"127.0.0.1",
                                    "port":5000,
                                    "zpl":"ZPL CODE"
                                }
                            

It appears when there are problems with the connection based on ip address / port between the server and the printer.

                                {
                                    "status":"failed",
                                    "error":{print error},
                                    "ip":"127.0.0.1",
                                    "port":5000
                                }