image printing fix
This commit is contained in:
@@ -566,6 +566,8 @@ public class HtmlPrinter : IEpsonPrinter
|
|||||||
|
|
||||||
// Get relative path for HTML
|
// Get relative path for HTML
|
||||||
var htmlDir = Path.GetDirectoryName(_outputPath) ?? ".";
|
var htmlDir = Path.GetDirectoryName(_outputPath) ?? ".";
|
||||||
|
if(htmlDir=="")
|
||||||
|
htmlDir=".";
|
||||||
var relativeImagePath = Path.GetRelativePath(htmlDir, imagePath).Replace('\\', '/');
|
var relativeImagePath = Path.GetRelativePath(htmlDir, imagePath).Replace('\\', '/');
|
||||||
|
|
||||||
// Add to HTML content
|
// Add to HTML content
|
||||||
|
|||||||
@@ -56,6 +56,9 @@ public class EpsonPrintService: IPrintService
|
|||||||
{
|
{
|
||||||
// Download logo image
|
// Download logo image
|
||||||
var logoFileName = Path.GetFileName(new Uri(job.Document.LogoUrl).LocalPath);
|
var logoFileName = Path.GetFileName(new Uri(job.Document.LogoUrl).LocalPath);
|
||||||
|
var ext = Path.GetExtension(logoFileName).ToLowerInvariant();
|
||||||
|
var encodedName = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(logoFileName));
|
||||||
|
logoFileName = $"{encodedName}{ext}";
|
||||||
var logoCachePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "logos");
|
var logoCachePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "logos");
|
||||||
|
|
||||||
// Ensure logos cache directory exists
|
// Ensure logos cache directory exists
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
using System.Text.Json;
|
using Inspectron.Epson.PrintServer.Printers.Utils;
|
||||||
using Inspectron.Epson.PrintServer.Printers.Utils;
|
|
||||||
using Inspectron.Epson.PrintServer.Printers.Utils.FinalRecipe;
|
using Inspectron.Epson.PrintServer.Printers.Utils.FinalRecipe;
|
||||||
using Inspectron.Epson.PrintServer.PrintServices;
|
using Inspectron.Epson.PrintServer.PrintServices;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text.Json;
|
||||||
using FinalReceipt = Inspectron.Epson.PrintServer.Printers.Utils.FinalRecipe.FinalReceipt;
|
using FinalReceipt = Inspectron.Epson.PrintServer.Printers.Utils.FinalRecipe.FinalReceipt;
|
||||||
|
|
||||||
namespace Inspectron.Epson.PrintServer.Printers;
|
namespace Inspectron.Epson.PrintServer.Printers;
|
||||||
@@ -22,9 +23,14 @@ public class TM_T30IIITranslated:IPrinter
|
|||||||
|
|
||||||
public async Task PrintImageAsync(string path)
|
public async Task PrintImageAsync(string path)
|
||||||
{
|
{
|
||||||
|
await _printer.FeedLinesAsync(1);
|
||||||
await _printer.SetAbsolutePrintPosition(100);
|
await _printer.SetAbsolutePrintPosition(100);
|
||||||
await _printer.LoadImageAsync(Path.Combine("logos", path), 384);
|
await _printer.LoadImageAsync(path, 384);
|
||||||
await Task.Delay(100);
|
await Task.Delay(100);
|
||||||
|
if (_printer is HtmlPrinter)
|
||||||
|
{
|
||||||
|
await _printer.PrintLoadedImage();
|
||||||
|
}
|
||||||
await _printer.FeedLinesAsync(1);
|
await _printer.FeedLinesAsync(1);
|
||||||
await _printer.SetAbsolutePrintPosition(0);
|
await _printer.SetAbsolutePrintPosition(0);
|
||||||
}
|
}
|
||||||
@@ -49,7 +55,6 @@ public class TM_T30IIITranslated:IPrinter
|
|||||||
}
|
}
|
||||||
var converter = new ReceiptConverter(lineWidth: 48, bigFontLineWidth: 24);
|
var converter = new ReceiptConverter(lineWidth: 48, bigFontLineWidth: 24);
|
||||||
var printCommands = converter.ConvertToPrintCommands(receipt);
|
var printCommands = converter.ConvertToPrintCommands(receipt);
|
||||||
await _printer.FeedLinesAsync(1);
|
|
||||||
await _printer.SetCustomLineSpacing(22);
|
await _printer.SetCustomLineSpacing(22);
|
||||||
|
|
||||||
foreach (var command in printCommands)
|
foreach (var command in printCommands)
|
||||||
|
|||||||
Reference in New Issue
Block a user