使用WebClientPrint C#打印条形码始终在中间列打印

时间:2018-09-11 02:11:08

标签: c# printing barcode neodynamic

我在打印条形码时遇到问题。我在C#中使用WebClientPrint(Neodynamic),当我发送打印命令时,它总是打印在纸张的中间一列(纸张每行有3个贴纸。)。如何在特定列上打印条形码, 示例,我有3个条形码,应该在左列打印第一个条形码,然后在中间打印第二个条形码,在右列打印第三个条形码。

 private ClientPrintJobGroup GenerateClientPrintJobGroup(List<BarcodeHolder> barcodeHolders, string paperName, string installedPrinterName)
    {
        ClientPrintJobGroup cpjg = new ClientPrintJobGroup();
        var installedPrinter = new InstalledPrinter
        {
            PrinterName = HttpUtility.UrlDecode(installedPrinterName),
            PaperName = paperName
        };

        foreach (var barcodeHolder in barcodeHolders)
        {
            for (int i = 0; i < barcodeHolder.quantity; i++)
            {
                var fileName = String.Concat("BARCODE_",
                    DateTime.Now.Year,
                    $"{DateTime.Now.Month:00}",
                    $"{DateTime.Now.Day:00}",
                    $"{DateTime.Now.Hour:00}",
                    $"{DateTime.Now.Minute:00}",
                    $"{DateTime.Now.Second:00}",
                    ".jpg");
                WriteFile(barcodeHolder.barcodeImage, fileName, out string filePath);
                var printFile = new PrintFile(Path.Combine(Server.MapPath(Url.Content(filePath)), fileName), Guid.NewGuid() + ".JPG");

                ClientPrintJob cpj = new ClientPrintJob
                {
                    ClientPrinter = installedPrinter,
                    PrintFile = printFile
                };
                cpjg.Add(cpj);
            }
        }

        return cpjg;
    }

对不起,我的语言,我正在努力提高英语水平。

0 个答案:

没有答案