This Python scripts processes a CSV file containing structured data, generates QR codes, and places them alongside formatted labels. The labels are then arranged on an A4 sheet for easy printing.
- Detects CSV file encoding dynamically using
chardet. - Generates QR codes with encoded information.
- Creates labels with formatted text.
- Places multiple labels onto A4-sized sheets.
- Supports automatic sorting by Division, City, and Name.
- Includes dotted lines for easy cutting of labels.
Make sure you have the following Python libraries installed:
pip install chardet pyqrcode pypng pillowFor Labels_HW_gen.py the CSV file should contain the following columns:
IDNameIPDivision(Subdivision)City
For Flag_labels_Cable_gen.py and Labels_Cable_gen.py the CSV file should contain the following columns:
SrcNameSrcIPSrcPortTrgNameTrgIPTrgPortSrcODF- optionalTrgODF- optional
The file should use ; as the delimiter and | as the quote character.
Modify the filename in the script and execute it:
csv_filename = 'your_file.csv'
output_dir = 'labels'
process_csv_file(csv_filename, output_dir)- QR code labels will be arranged on A4 sheets.
- Output files will be saved in the specified directory.
- The generated images will have dotted lines for easy cutting.
The script will generate files like labels_a4_sheet_1.png, labels_a4_sheet_2.png, etc.
This project is open-source and available under the MIT License.