无法弄清楚如何将副本传递到DYMO.Label.Framework.3.0.js SDK

时间:2019-02-22 12:04:42

标签: javascript php sdk

我已经在互联网上搜索了三个星期,并且已经为Dymo工程公司等待了10天时间,以回答有关设置打印份数的问题。

这是我的帖子: http://developers.dymo.com/2018/05/29/updated-js-sdk-and-dls/#comment-85589

我收到了工程人员的一封回复,并被告知转到此页面。 http://labelwriter.com/software/dls/sdk/docs/DYMOLabelFrameworkJavaScriptHelp/symbols/dymo.label.framework.ILabel.html#print

此页面将回答我的所有问题。哈!

在页面上,有此条目。 {string} printParamsXml 打印参数,例如份数,打印质量等。请参见PrintParams.xsd。 http://labelwriter.com/software/dls/sdk/PrintParams.xsd

对我来说,这只是一个XML页面。它没有告诉我如何将所需的信息传递给

w("dymo.label.framework.createTapePrintParamsXml",function(a){if(!a)return"";var b=R("<TapePrintParams/>"),d=b.documentElement;a.copies&&S(d,"Copies",a.copies.toString());a.jobTitle&&S(d,"JobTitle",a.jobTitle);a.flowDirection&&S(d,"FlowDirection",a.flowDirection);a.alignment&&S(d,"Alignment",a.alignment);a.cutMode&&S(d,"CutMode",a.cutMode);return ie(b)});

http://labelwriter.com/software/dls/sdk/js/DYMO.Label.Framework.3.0.js内部。

我正在调用函数的第402行 https://github.com/juggernautsei/dymo-print-logic/blob/juggernautsei-patch-3/PrintMeThatLabel.js

但是,当我打印时,只打印了一个标签。我必须备份,让您知道我发现了什么。

http://labelwriter.com/software/dls/sdk/docs/DYMOLabelFrameworkJavaScriptHelp/symbols/dymo.label.framework.html#.printLabel

dymo.label.framework.printLabel(printerName,printParamsXml,labelXml,labelSetXml) 打印一个或多个标签。

我已经为此设置了代码。

            var labelSet = new dymo.label.framework.LabelSetBuilder();
            var params = dymo.label.framework.createLabelWriterPrintParamsXml({Copies:copies});

            labelSet.addRecord().setText(objName, text);


            // print
            //label.print(printer.name, null, labelSet.toString());
            // print and get status
            var printJob = label.printAndPollStatus(printer.name, params.copies, labelSet.toString(), function(printJob, printJobStatus)
            {

我仍然可以得到一个标签。似乎我掌握了所有难题,但无法完成所有工作。帮助...请。

1 个答案:

答案 0 :(得分:1)

var params = dymo.label.framework.createLabelWriterPrintParamsXml({copies:2,twinTurboRoll:'Right',printQuality:'Text'});                
//now params contains <LabelWriterPrintParams><Copies>2</Copies><PrintQuality>Text</PrintQuality><TwinTurboRoll>Right</TwinTurboRoll></LabelWriterPrintParams>
var printJob = label.printAndPollStatus(printer.name, params, labelSet.toString(), function(printJob, printJobStatus)
{
    // output status
    var statusStr = 'Job Status: ' + printJobStatus.statusMessage;

    var result = (printJobStatus.status != dymo.label.framework.PrintJobStatus.ProcessingError 
    && printJobStatus.status != dymo.label.framework.PrintJobStatus.Finished);

    // reenable when the job is done (either success or fail)
    printButton.disabled = result;

    //if (!result)
    //    statusStr = '';

    setTextContent(jobStatusMessageSpan, statusStr);

    return result;

}, 1000);

与DYMO labelWriter无线打印机配合使用效果很好