兄弟b-PAC SDK打开模板和结束打印非常慢

问题描述 投票:0回答:1

我使用.NET Framework 4.8

我有一个标签 API,我使用 b-PAC SDK 来打印到标签打印机。
在这种情况下,假设 5 个人使用相同的模板在同一台标签打印机上进行打印,彼此之间最多间隔 10 秒。

但是

Open()
EndPrint()
即使总共需要 50 分钟才能完成。

在这种情况下,

Open()
方法需要 40 秒才能完成,
EndPrint()
方法需要 50 秒才能完成。
这意味着对我的标签 API 的打印请求大约需要 2 分钟才能打印。

我有很多情况总共超过30分钟。

请参阅此示例的日志记录:

Logging example[]

public void Print(string printer, string label, int copyCount, Settings settings, ILogger _logger) {
    bpac.DocumentClass doc = new bpac.DocumentClass();

    using (ITimer timer = _logger.Time("Open Template")) {
        if (!doc.Open(string.Format(_pathTemaplate, label))) {
            throw new Exception("Document couldn't be opened");
        }
    }

    using (ITimer timer = _logger.Time("Set Printer")) {
        if (!doc.SetPrinter("{printer}", false)) {
            throw new Exception("Couldn't set printer");
        }
    }

    foreach (KeyValuePair<string, string> kv in settings.Data) {
        bpac.IObject field = doc.GetObject(kv.Key);
        if (field == null) {
            continue;
        }
        field.Text = kv.Value;
    }

    PrintOptionConstants options = PrintOptionConstants.bpoDefault;

    try {
        using (ITimer timer = _logger.Time("Start Print")) {
            doc.StartPrint(label, options);
        }

        using (ITimer timer = _logger.Time("Printing")) {
            for (int i = 0; i < copyCount; i++) {
                doc.PrintOut(1, options);
            }
        }

        using (ITimer timer = _logger.Time("End Print")) {
            doc.EndPrint();
        }

    }
    finally {
        using (ITimer timer = _logger.Time("Close document")) {
            doc.Close();
        }
    }
}
c# .net printing brother-print-sdk brother-bpac
1个回答
0
投票

从本地服务器转移到云端后,Open() 和 SetPrinter() 速度变慢。 我使用 32 位 Delphi 软件已有 5 年,并注意到某些用户存在各种延迟。 即使是 P-touch 5.4 也很慢,启动 30 秒。

锁定解决方案。

© www.soinside.com 2019 - 2024. All rights reserved.