Pdf 417 barcode
ImprimirCodigoDeBarrasPdf417
Print a barcode in PDF417 format. The algorithm refers to the algorithm used to convert the image, which can be 0 to use the Raster Bit Image method, 1 for BIT Image Column Format and 2 for NV Graphics. The most recent printers support NV Graphics, the old support Raster Bit Image and Image Column Format. More information about algorithms: https://parzibyte.me/blog/2024/01/17/metodos-imprimir-imagenes-impresoras-termicas/ The other parameters are related to the code generation algorithm Note: The security level is related to the barcode generation algorithm itself, not to the plugin. It must be between 0 and 8
Arguments
Barcode content (argumentos[0]
)
Description: Barcode content
Index: 0
Type: string
Example: 50123452
Security level (argumentos[1]
)
Description: Security level
Index: 1
Type: float64
Example: 1
Barcode height (argumentos[2]
)
Description: Barcode height
Index: 2
Type: float64
Example: 80
Barcode width (argumentos[3]
)
Description: Barcode width
Index: 3
Type: float64
Example: 380
Algorithm to convert image to ESC POS bytes (0, 1 o 2) (argumentos[4]
)
Description: Algorithm to convert image to ESC POS bytes (0, 1 o 2)
Index: 4
Type: float64
Example: 0
Operation example
Push this operation to the operation list (whose key is operaciones
) that you will send with the request.
Its name is ImprimirCodigoDeBarrasPdf417
, so it goes on the nombre
key. Then put the arguments in order inside the argumentos
array.
Don't forget to check every argument type
{
"nombre": "ImprimirCodigoDeBarrasPdf417",
"argumentos": [
"50123452",
1,
80,
380,
0
]
}
Tips
Remember: the operation list (operaciones
) can contain infinite operations, this is only one of them
Example (JavaScript client side)
Playground
Select an operation below
const payload = {
"serial": "",
"nombreImpresora": "",
"operaciones": []
};
const httpResponse = await fetch("http://localhost:8000/imprimir", {
method: "POST",
body: JSON.stringify(payload)
});
const response = await httpResponse.json();
if (respuesta.ok) {
console.log("Printed successfully")
} else {
console.error("Request OK but plugin error: " + respuesta.message);
}
Iniciar: Initialize printer.Clean the data in the buffer and restart the printer to the state it was when it was turned on. In some printers it is recommended to invoke this function before and after printing images.
EscribirTexto: Write text in the printer. The text will not be printed until a line jump (\n) is found or Feed is invoked
Pulso: It generates an electric pulse (used to open the cash drawer) taking into account the on time which are the milliseconds to turn on and the milliseconds to turn off according to the off time. The pin can be 48 or 49. The recommended pin is 48, on time of 60 and off time of 120.
CorteParcial: Partial cut
Corte: Full cut
Feed: Print the data stored in the printer buffer (stored when writing text) and feeds paper a number of lines
TextoSegunPaginaDeCodigos: Allows you to write diacritic text. You have to specify the page number (according to the printer) and the Character Code Page for ICONV. It is suggested to try every combination if it does not work at first. This function has no effect if the used plugin version is the version that has no iconv
EstablecerAlineacion: Set text, images, barcodes and QR codes justification according to the alignment providad. Left is 0, center 1 and right 2
EstablecerTamañoFuente: Set the font size according to the width and height multiplier. Both values can range from 1 to 8. It also affects personalized characters
EstablecerSubrayado: Enable or disable underlined text mode
EstablecerEnfatizado: Enable or disable bold text mode
EstablecerImpresionAlReves: Enable or disable upside down print
EstablecerRotacionDe90Grados: Enable or disable 90 degrees rotation
EstablecerImpresionBlancoYNegroInversa: Enable or disable inverse print. In reverse mode, the background is black and the text is white
EstablecerFuente: Set the font, which can be 0 or 1. In my case it only supports a source that is the A. Be careful when changing the font and trying to print a personalized character, because at the moment it only works with the source to
HabilitarCaracteresPersonalizados: Enable custom characters. If it is enabled then you will print the custom character instead of the character that was supplied to be replaced
DeshabilitarCaracteresPersonalizados: Disable custom characters
DeshabilitarElModoDeCaracteresChinos: Disable chinese character mode. Use it when printing diacritic text and you have a chinese printer. Use it along with TextoSegunPaginaDeCodigos
HabilitarElModoDeCaracteresChinos: Enable chinese character mode
DefinirCaracterPersonalizado: Defines a custom 24x12 character. It is useful for printing characters not supported by some printers, either the euro, penny or what you can draw in a 24x12 box. This function establishes the personalized character but does not print it. Only It is necessary to call it once, and then every time the replaced character is printed, the custom character will be printed instead. The matrix as string must be, as its name says, a matrix as a string. You must have exactly 24 lines (separated by a line jump) and in each line there must be exactly 12 digits, each digit must be a 1 or 0. There should be no tabulations or extra spaces Note: The matrix is 24x12 because this is the source A. If it were the source B would be 17x9, but that source doesn't work in my printer so I haven't tried. So, do not try this if you have source B select. For this operation to work, you need to call HabilitarCaracteresPersonalizados before
CargarImagenLocalEImprimir: Prints an existing image on the file system, provided that the plugin has the permissions to access it. The image will be converted to black and white. If the width of the image is greater than the maximum width specified, the image will be resized to match. Algorithm refers to the algorithm used when printing an image, which can be 0 for using the Raster Bit Image method, 1 for Bit Image Column Format and 2 for NV Graphics. Newer printers support NV Graphics, older ones support Raster Bit Image and Image Column Format. It is recommended that the user tries all 3 algorithms to find the most suitable one. More information about the algorithms: https://parzibyte.me/blog/2024/01/17/methods-for-printing-images-thermal-printers/ . The dithering parameter indicates whether the Floyd-Steinberg-Dithering algorithm should be applied to the image before it is printed. It is recommended to apply it to pictures (and no illustrations), so that the lighting and details are maintained even when converted to black and white. More information about dithering: https://parzibyte.me/blog/2024/07/28/algoritmo-floyd-steinberg-dithering-golang/
DescargarImagenDeInternetEImprimir: Download an internet image and print it. The image must be publicly accessible using only the URL. The image will be converted to black and white. If the width of the image is greater than the maximum width specified, the image will be resized to match. Algorithm refers to the algorithm used when printing an image, which can be 0 for using the Raster Bit Image method, 1 for Bit Image Column Format and 2 for NV Graphics. Newer printers support NV Graphics, older ones support Raster Bit Image and Image Column Format. It is recommended that the user tries all 3 algorithms to find the most suitable one. More information about the algorithms: https://parzibyte.me/blog/2024/01/17/methods-for-printing-images-thermal-printers/ . The dithering parameter indicates whether the Floyd-Steinberg-Dithering algorithm should be applied to the image before it is printed. It is recommended to apply it to pictures (and no illustrations), so that the lighting and details are maintained even when converted to black and white. More information about dithering: https://parzibyte.me/blog/2024/07/28/algoritmo-floyd-steinberg-dithering-golang/
GenerarImagenAPartirDeHtmlEImprimir: It generates an image from the HTML using the page width as the width of the screen of the web browser to render the image, and then prints the generated image. The image will be converted to black and white. If the width of the image is greater than the maximum width specified, the image will be resized to match. Algorithm refers to the algorithm used when printing an image, which can be 0 for using the Raster Bit Image method, 1 for Bit Image Column Format and 2 for NV Graphics. Newer printers support NV Graphics, older ones support Raster Bit Image and Image Column Format. It is recommended that the user tries all 3 algorithms to find the most suitable one. More information about the algorithms: https://parzibyte.me/blog/2024/01/17/methods-for-printing-images-thermal-printers/ . The dithering parameter indicates whether the Floyd-Steinberg-Dithering algorithm should be applied to the image before it is printed. It is recommended to apply it to pictures (and no illustrations), so that the lighting and details are maintained even when converted to black and white. More information about dithering: https://parzibyte.me/blog/2024/07/28/algoritmo-floyd-steinberg-dithering-golang/
GenerarImagenAPartirDePaginaWebEImprimir: It generates an image from the HTML generated by the website located in the provided URL using the providad width as the width of the screen of the web browser to render the image. Then, that generated image is printed. You need wkhtmltoimage located on the PATH or in the same directory of the plugin. The image will be converted to black and white. If the width of the image is greater than the maximum width specified, the image will be resized to match. Algorithm refers to the algorithm used when printing an image, which can be 0 for using the Raster Bit Image method, 1 for Bit Image Column Format and 2 for NV Graphics. Newer printers support NV Graphics, older ones support Raster Bit Image and Image Column Format. It is recommended that the user tries all 3 algorithms to find the most suitable one. More information about the algorithms: https://parzibyte.me/blog/2024/01/17/methods-for-printing-images-thermal-printers/ . The dithering parameter indicates whether the Floyd-Steinberg-Dithering algorithm should be applied to the image before it is printed. It is recommended to apply it to pictures (and no illustrations), so that the lighting and details are maintained even when converted to black and white. More information about dithering: https://parzibyte.me/blog/2024/07/28/algoritmo-floyd-steinberg-dithering-golang/
ImprimirImagenEnBase64: Convert the base64 string to an image. The encoded image in Base64 can be JPG or PNG and may or may not have the "base64,". The image will be converted to black and white. If the width of the image is greater than the maximum width specified, the image will be resized to match. Algorithm refers to the algorithm used when printing an image, which can be 0 for using the Raster Bit Image method, 1 for Bit Image Column Format and 2 for NV Graphics. Newer printers support NV Graphics, older ones support Raster Bit Image and Image Column Format. It is recommended that the user tries all 3 algorithms to find the most suitable one. More information about the algorithms: https://parzibyte.me/blog/2024/01/17/methods-for-printing-images-thermal-printers/ . The dithering parameter indicates whether the Floyd-Steinberg-Dithering algorithm should be applied to the image before it is printed. It is recommended to apply it to pictures (and no illustrations), so that the lighting and details are maintained even when converted to black and white. More information about dithering: https://parzibyte.me/blog/2024/07/28/algoritmo-floyd-steinberg-dithering-golang/
ImprimirCodigoDeBarrasCode39: Print a bar code in CODE39 format. The algorithm refers to the algorithm used to print the image, which can be 0 to use the Raster Bit Image method, 1 for BIT Image Column Format and 2 for NV Graphics. The most recent printers support NV Graphics, the old support Raster Bit Image and Image Column Format. More information about algorithms: https://parzibyte.me/blog/2024/01/17/metodos-imprimir-imagenes-impresoras-termicas/ The other parameters are related to the code generation algorithm
ImprimirCodigoDeBarrasCode93: Print a bar code in CODE93 format. The algorithm refers to the algorithm used to print the image, which can be 0 to use the Raster Bit Image method, 1 for BIT Image Column Format and 2 for NV Graphics. The most recent printers support NV Graphics, the old support Raster Bit Image and Image Column Format. More information about algorithms: https://parzibyte.me/blog/2024/01/17/metodos-imprimir-imagenes-impresoras-termicas/ The other parameters are related to the code generation algorithm
ImprimirCodigoDeBarrasPdf417: Print a barcode in PDF417 format. The algorithm refers to the algorithm used to convert the image, which can be 0 to use the Raster Bit Image method, 1 for BIT Image Column Format and 2 for NV Graphics. The most recent printers support NV Graphics, the old support Raster Bit Image and Image Column Format. More information about algorithms: https://parzibyte.me/blog/2024/01/17/metodos-imprimir-imagenes-impresoras-termicas/ The other parameters are related to the code generation algorithm Note: The security level is related to the barcode generation algorithm itself, not to the plugin. It must be between 0 and 8
ImprimirCodigoDeBarrasUpcA: Print a bar code in UPCA format. The algorithm refers to the algorithm used to print the image, which can be 0 to use the Raster Bit Image method, 1 for BIT Image Column Format and 2 for NV Graphics. The most recent printers support NV Graphics, the old support Raster Bit Image and Image Column Format. More information about algorithms: https://parzibyte.me/blog/2024/01/17/metodos-imprimir-imagenes-impresoras-termicas/ The other parameters are related to the code generation algorithm
ImprimirCodigoDeBarrasUpcE: Print a bar code in UPC E format. The algorithm refers to the algorithm used to print the image, which can be 0 to use the Raster Bit Image method, 1 for BIT Image Column Format and 2 for NV Graphics. The most recent printers support NV Graphics, the old support Raster Bit Image and Image Column Format. More information about algorithms: https://parzibyte.me/blog/2024/01/17/metodos-imprimir-imagenes-impresoras-termicas/ The other parameters are related to the code generation algorithm
ImprimirCodigoDeBarrasEan: Print a bar code in EAN format. The algorithm refers to the algorithm used to print the image, which can be 0 to use the Raster Bit Image method, 1 for BIT Image Column Format and 2 for NV Graphics. The most recent printers support NV Graphics, the old support Raster Bit Image and Image Column Format. More information about algorithms: https://parzibyte.me/blog/2024/01/17/metodos-imprimir-imagenes-impresoras-termicas/ The other parameters are related to the code generation algorithm
ImprimirCodigoDeBarrasEan8: Print a bar code in EAN8 format. The algorithm refers to the algorithm used to print the image, which can be 0 to use the Raster Bit Image method, 1 for BIT Image Column Format and 2 for NV Graphics. The most recent printers support NV Graphics, the old support Raster Bit Image and Image Column Format. More information about algorithms: https://parzibyte.me/blog/2024/01/17/metodos-imprimir-imagenes-impresoras-termicas/ The other parameters are related to the code generation algorithm
ImprimirCodigoDeBarrasTwoOfFiveITF: Print a barcode on TWO of Five Itf format (interleaved 2 of 5). The algorithm refers to the algorithm used to print the image, which can be 0 to use the Raster Bit Image method, 1 for BIT Image Column Format and 2 for NV Graphics. The most recent printers support NV Graphics, the old support Raster Bit Image and Image Column Format. More information about algorithms: https://parzibyte.me/blog/2024/01/17/metodos-imprimir-imagenes-impresoras-termicas/ The other parameters are related to the code generation algorithm Note: The "interleaved" parameter is typical of the barcode algorithm, not the plugin
ImprimirCodigoDeBarrasCodabar: Print a barcode in Codabar format. The algorithm refers to the algorithm used to print the image, which can be 0 to use the Raster Bit Image method, 1 for BIT Image Column Format and 2 for NV Graphics. The most recent printers support NV Graphics, the old support Raster Bit Image and Image Column Format. More information about algorithms: https://parzibyte.me/blog/2024/01/17/metodos-imprimir-imagenes-impresoras-termicas/ The other parameters are related to the code generation algorithm
ImprimirCodigoDeBarrasCode128: Print a bar code in CODE128 format. The algorithm refers to the algorithm used to print the image, which can be 0 to use the Raster Bit Image method, 1 for BIT Image Column Format and 2 for NV Graphics. The most recent printers support NV Graphics, the old support Raster Bit Image and Image Column Format. More information about algorithms: https://parzibyte.me/blog/2024/01/17/metodos-imprimir-imagenes-impresoras-termicas/ The other parameters are related to the code generation algorithm
ImprimirCodigoQr: Print a QR code. The algorithm refers to the algorithm used to print the image, which can be 0 to use the Raster Bit Image method, 1 for BIT Image Column Format and 2 for NV Graphics. The most recent printers support NV Graphics, the old support Raster Bit Image and Image Column Format. More information about algorithms: https://parzibyte.me/blog/2024/01/17/metodos-imprimir-imagenes-impresoras-termicas/ The other parameters are related to the code generation algorithm Note: The error correction is related to the QR generating algorithm, not the plugin. It can be 0 (low), 1 (medium), 2 (high) and 3 (Highest). Medium is recommended
Beep: Beeps the buzzer. Produces a sound in the thermal printer. Also take a look at BeepAndSound
BeepAndAlarm: Beeps the buzzer (Produces a sound in the thermal printer) and turns on the integrated LED (alarm). It is useful for making a beep and notify something. In my printer, Beep ignores the duration of the sound, but BeepAndAlarm takes it into account. With this operation, you can either emit a sound, silently turn on the LED, both, or neither.
Code example
const payload = {
"serial": "",
"nombreImpresora": "Printers_name",
"operaciones": [
{
"nombre": "ImprimirCodigoDeBarrasPdf417",
"argumentos": [
"50123452",
1,
80,
380,
0
]
}
]
};
const httpResponse = await fetch("http://localhost:8000/imprimir",
{
method: "POST",
body: JSON.stringify(payload),
});
const jsonResponse = await httpResponse.json();
if (jsonResponse.ok) {
// Everything is ok
console.log("Printed successfully");
} else {
// Error message is on message property
console.error(jsonResponse.message)
}
Example JSON (not encoded)
Encode this JSON and send it to http://localhost:8000/imprimir
with POST method
{
"serial": "",
"nombreImpresora": "Printers_name",
"operaciones": [
{
"nombre": "ImprimirCodigoDeBarrasPdf417",
"argumentos": [
"50123452",
1,
80,
380,
0
]
}
]
}
Example JSON (encoded)
Send this JSON string to http://localhost:8000/imprimir
with POST method
{"serial":"","nombreImpresora":"Printers_name","operaciones":[{"nombre":"ImprimirCodigoDeBarrasPdf417","argumentos":["50123452",1,80,380,0]}]}