This API allows you to convert a PDF file to ZPL code that can be used to print labels on Zebra printers. You can specify the width and height of the label in inches, and the API will generate ZPL code for each page of the PDF file.
The API endpoint for this service is https://pdf-to-zpl.p.rapidapi.com/pdf-to-zpl
.
To make a request to the API, send a POST request to the endpoint with the following parameters:
width
(required): The width of the label in inches.height
(required): The height of the label in inches.pdfBase64
(required): The base64-encoded PDF file.Here is an example request using cURL:
curl --request POST \
--url https://pdf-to-zpl.p.rapidapi.com/pdf-to-zpl \
--header 'X-RapidAPI-Host: pdf-to-zpl.p.rapidapi.com' \
--header 'X-RapidAPI-Key: YOUR_API_KEY' \
--header 'content-type: application/x-www-form-urlencoded' \
--data width=4 \
--data height=6 \
--data 'pdfBase64=BASE64_ENCODED_PDF_FILE'
Replace YOUR_API_KEY
with your RapidAPI key and BASE64_ENCODED_PDF_FILE
with the base64-encoded PDF file.
The API will return a string containing the ZPL code for the first page of the PDF file.
If an error occurs, the API will return a JSON object with an error key and a message describing the error.
Here’s some sample code you can use to call the API using Python:
import requests
url = "https://pdf-to-zpl.p.rapidapi.com/pdf-to-zpl"
payload = {'width': '4',
'height': '6',
'pdfBase64': 'BASE64_ENCODED_PDF_FILE'}
headers = {
'X-RapidAPI-Host': 'pdf-to-zpl.p.rapidapi.com',
'X-RapidAPI-Key': 'YOUR_API_KEY',
'content-type': 'application/x-www-form-urlencoded'
}
response = requests.post(url, headers=headers, data=payload)
print(response.text)
Replace YOUR_API_KEY
with your RapidAPI key and BASE64_ENCODED_PDF_FILE
with the base64-encoded PDF file.
This API is subject to rate limiting. Please refer to the pricing tab above for your usage limits.
If you need help using this API or have any questions, please contact the developer in about tab above.