Skip to content

ZPL2PDF is a project for converting labels in ZPL format into a PDF file. The program processes the labels, renders images in memory and compiles these images into a PDF, where each page contains a label.

License

Notifications You must be signed in to change notification settings

brunoleocam/ZPL2PDF

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Documentation - ZPL2PDF

Introduction

This project is built on top of the BinaryKits.Zpl library.

ZPL2PDF is a project for converting labels in ZPL format into a PDF file. The program processes the labels, renders images in memory and compiles these images into a PDF, where each page contains a label.

Features

  • Label Processing: Uses the LabelFileReader class to read the file and separate the labels based on the ^XA and ^XZ delimiters.

  • In-Memory Rendering: The LabelRenderer class analyzes the ZPL content and renders the labels into images, keeping the data in memory without the need for temporary storage.

  • PDF Generation: The PdfGenerator class generates a PDF where each image is added to a page. The PDF file is saved in the user's specified output folder, using the specified output file name or a default name based on the current date and time.

Execution Flow

  1. Receiving Parameters:
    The Main method analyzes the arguments received:

    • The -i parameter specifies the input file path.
    • The -z parameter specifies the ZPL content directly.
    • The -o parameter specifies the output folder path.
    • The -n parameter specifies the output file name (optional).
  2. Content reading
    The file is read using LabelFileReader.ReadFile(inputFile) or the ZPL content is used directly.

  3. Label separation:
    The LabelFileReader.SplitLabels(fileContent) method splits the content into individual labels, based on the ^XA and ^XZ delimiters.

  4. Image rendering
    The LabelRenderer class processes each label and renders images (in byte[]) with the defined dimensions and density.

  5. PDF generation:
    The PDF is generated using the PdfGenerator.GeneratePdf(imageDataList, outputPdf) class, where outputPdf is built in the specified output folder with the specified output file name or a default name.

Usage Examples

  1. Specifying the Input and Output:

    • Reads the specified file and saves it in the specified output folder.

      ZPL2PDF.exe -i "C:\Path\to\input.txt" -o "C:\Path\to\output"
  2. Specifying the ZPL Content Directly:

    • Uses the specified ZPL content and saves it in the specified output folder.

      ZPL2PDF.exe -z "^XA^FO50,50^ADN,36,20^FDHello, World!^FS^XZ" -o "C:\Path\to\output"
  3. Specifying the Output File Name:

    • Reads the specified file, saves it in the specified output folder with the specified output file name.

      ZPL2PDF.exe -i "C:\Path\to\input.txt" -o "C:\Path\to\output" -n "output_filename.pdf"

Integration with Other Systems

The program can be compiled into an executable (ZPL2PDF.exe) and called from another application, such as an ERP, using functions to start processes (e.g., Process.Start in C#) and passing the necessary parameters.

Dependencies

  • BinaryKits.Zpl: For analyzing and rendering ZPL labels.
  • PdfSharpCore: For creating and manipulating the PDF file.

Conclusion

ZPL2PDF was developed with a focus on modularization (separate classes for reading, rendering, and generating the PDF) and flexibility, allowing different input options and easy integration with other systems.

Other Languages

About

ZPL2PDF is a project for converting labels in ZPL format into a PDF file. The program processes the labels, renders images in memory and compiles these images into a PDF, where each page contains a label.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages