print server with new concept
This commit is contained in:
@@ -4,6 +4,7 @@ using SixLabors.ImageSharp.Formats.Png;
|
||||
using SixLabors.ImageSharp.PixelFormats;
|
||||
using SixLabors.ImageSharp.Processing;
|
||||
using System.Text;
|
||||
using Inspectron.Epson.PrintServer.PrintServices;
|
||||
|
||||
namespace Inspectron.Epson;
|
||||
|
||||
@@ -14,6 +15,7 @@ namespace Inspectron.Epson;
|
||||
public class HtmlPrinter : IEpsonPrinter
|
||||
{
|
||||
private readonly ILogger? _logger;
|
||||
private readonly byte _id;
|
||||
private readonly string _outputPath;
|
||||
private readonly int _paperWidth;
|
||||
private readonly string _imageDirectory;
|
||||
@@ -60,11 +62,12 @@ public class HtmlPrinter : IEpsonPrinter
|
||||
/// <param name="outputPath">Path to the output HTML file</param>
|
||||
/// <param name="paperWidth">Paper width in pixels (default 384 for 80mm thermal printer)</param>
|
||||
/// <param name="logger">Optional logger for diagnostic output</param>
|
||||
public HtmlPrinter(string outputPath, int paperWidth = 384, ILogger? logger = null)
|
||||
public HtmlPrinter(string outputPath, int paperWidth = 384, ILogger? logger = null, byte id=0x01)
|
||||
{
|
||||
_outputPath = outputPath;
|
||||
_paperWidth = paperWidth;
|
||||
_logger = logger;
|
||||
_id = id;
|
||||
|
||||
// Create image directory next to HTML file
|
||||
var directory = Path.GetDirectoryName(outputPath) ?? ".";
|
||||
@@ -174,8 +177,7 @@ public class HtmlPrinter : IEpsonPrinter
|
||||
/// <inheritdoc />
|
||||
public Task<byte?> GetPrinterIdAsync()
|
||||
{
|
||||
_logger?.LogDebug("HtmlPrinter: Returning mock printer ID (0x01 = TM-T30III)");
|
||||
return Task.FromResult<byte?>(0x01);
|
||||
return Task.FromResult<byte?>(_id);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -320,9 +322,6 @@ public class HtmlPrinter : IEpsonPrinter
|
||||
{
|
||||
EnsureConnected();
|
||||
_logger?.LogInformation("HtmlPrinter: Cutting paper");
|
||||
|
||||
_content.AppendLine("<div class=\"cut\"><span class=\"scissors\">✂</span></div>");
|
||||
|
||||
WriteHtmlFile();
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
@@ -493,7 +492,7 @@ public class HtmlPrinter : IEpsonPrinter
|
||||
|
||||
if (_isBiggerFontTM220)
|
||||
{
|
||||
effectiveHeightMultiplier *= 2;
|
||||
effectiveWidthMultiplier *= 2;
|
||||
}
|
||||
|
||||
int fontSize = baseHeight * effectiveHeightMultiplier;
|
||||
|
||||
Reference in New Issue
Block a user