Files
CGW-Printing/PrintService/Models/PrinterConfig.cs
T

94 lines
2.9 KiB
C#

namespace PrintService.Models;
/// <summary>
/// Root configuration loaded from printer-config.json
/// </summary>
public class PrinterConfiguration
{
public Dictionary<string, DocumentTypeConfig> DocumentTypes { get; set; } = new();
}
/// <summary>
/// Configuration for a single document type (replaces DocumentConfig for printer/tray mapping)
/// </summary>
public class DocumentTypeConfig
{
public string Name { get; set; } = string.Empty;
public List<PageConfig> Pages { get; set; } = new();
// Rendering settings
public string FontName { get; set; } = "Courier New";
public float FontSize { get; set; } = 10f;
public int HorizontalOffset { get; set; } = 0;
public int VerticalOffset { get; set; } = 0;
// Post-processing settings
public bool ArchiveAfterPrint { get; set; } = true;
public string? ArchivePath { get; set; }
public string? OutputPath { get; set; }
public bool SkipPostProcessing { get; set; } = false;
// Text transformation rules
public List<TextTransform> Transformations { get; set; } = new();
// Rust transformation properties
/// <summary>
/// Left margin/indent for all lines (in 1/100 inch units)
/// </summary>
public int LinePadding { get; set; } = 0;
/// <summary>
/// Remove both "Order #: " label and the order number entirely
/// </summary>
public bool RemoveOrderNumber { get; set; } = false;
/// <summary>
/// Remove "Order #: " label but keep the order number (and make it bold)
/// </summary>
public bool RemoveOrderNumberLabel { get; set; } = false;
/// <summary>
/// Add spacing before the order number (shifts it right)
/// </summary>
public string IndentOrderNumber { get; set; } = string.Empty;
/// <summary>
/// Vertical position adjustments per line (line number → adjustment in 1/100 inch)
/// Negative values move up, positive values move down
/// </summary>
public Dictionary<int, int> RowShift { get; set; } = new();
/// <summary>
/// Horizontal character trimming per line (line number → trim configuration)
/// Removes characters from Start to End indices
/// </summary>
public Dictionary<int, RowTrimConfig> RowTrim { get; set; } = new();
}
/// <summary>
/// Configuration for a single page (printer and tray assignment)
/// </summary>
public class PageConfig
{
public int PageNumber { get; set; }
public string PrinterName { get; set; } = string.Empty;
public int TrayNumber { get; set; }
public string? TrayLabel { get; set; }
}
/// <summary>
/// Configuration for row trimming (horizontal character removal)
/// </summary>
public class RowTrimConfig
{
/// <summary>
/// Start index of characters to remove (0-based)
/// </summary>
public int Start { get; set; }
/// <summary>
/// End index of characters to remove (exclusive)
/// </summary>
public int End { get; set; }
}