Пример #1
0
        static string RenderLabel1()
        {
            var sampleText = "[_~^][LineBreak\n][The quick fox jumps over the lazy dog.]";
            var font       = new ZplFont(fontWidth: 50, fontHeight: 50);

            var elements = new ZplElementBase[]
            {
                new ZplTextField(sampleText, 50, 100, font),
                new ZplGraphicBox(400, 700, 100, 100, 5),
                new ZplGraphicBox(200, 700, 100, 200, 3, cornerRounding: 8),
                new ZplGraphicBox(450, 750, 100, 100, 50, LineColor.White),
                new ZplGraphicCircle(400, 700, 100, 5),
                new ZplGraphicDiagonalLine(400, 700, 100, 50, 5),
                new ZplGraphicDiagonalLine(400, 700, 50, 100, 5),
                new ZplGraphicSymbol(GraphicSymbolCharacter.Copyright, 600, 600, 50, 50),

                //Add raw zpl code
                new ZplRaw("^FO200, 200^GB300, 200, 10 ^FS")
            };

            var renderEngine = new ZplEngine(elements);

            return(renderEngine.ToZplString(new ZplRenderOptions
            {
                //AddEmptyLineBeforeElementStart = true,
                SourcePrintDpi = 203,
                TargetPrintDpi = 203
            }));
        }
Пример #2
0
        public void MultipleElements()
        {
            var sampleText = "[_~^][LineBreak\n][The quick fox jumps over the lazy dog.]";
            var font       = new ZplFont(fontWidth: 50, fontHeight: 50);

            var elements = new List <ZplElementBase>();

            elements.Add(new ZplTextField(sampleText, 50, 100, font));
            elements.Add(new ZplGraphicBox(400, 700, 100, 100, 5));
            elements.Add(new ZplGraphicBox(450, 750, 100, 100, 50, LineColor.White));
            elements.Add(new ZplGraphicCircle(400, 700, 100, 5));
            elements.Add(new ZplGraphicDiagonalLine(400, 700, 100, 50, 5));
            elements.Add(new ZplGraphicDiagonalLine(400, 700, 50, 100, 5));
            elements.Add(new ZplGraphicSymbol(GraphicSymbolCharacter.Copyright, 600, 600, 50, 50));
            elements.Add(new ZplQrCode("MM,AAC-42", 200, 800));

            //Add raw Zpl code
            elements.Add(new ZplRaw("^FO200, 200^GB300, 200, 10 ^FS"));

            var renderEngine = new ZplEngine(elements);
            var output       = renderEngine.ToZplString(new ZplRenderOptions {
                AddEmptyLineBeforeElementStart = true
            });

            Debug.WriteLine(output);
        }
Пример #3
0
        public void TextFieldVariations()
        {
            var sampleText = "[_~^][LineBreak\n][The quick fox jumps over the lazy dog.]";
            var font       = new ZplFont(fontWidth: 50, fontHeight: 50);

            var elements = new List <ZplElementBase>();

            //Specail character is repalced with space
            elements.Add(new ZplTextField(sampleText, 10, 10, font, useHexadecimalIndicator: false));
            //Specail character is using Hex value ^FH
            elements.Add(new ZplTextField(sampleText, 10, 50, font, useHexadecimalIndicator: true));
            //Only the first line is displayed
            elements.Add(new ZplSingleLineFieldBlock(sampleText, 10, 150, 500, font));
            //Max 2 lines, text exceeding the maximum number of lines overwrites the last line.
            elements.Add(new ZplFieldBlock(sampleText, 10, 300, 400, font, 2));
            // Multi - line text within a box region
            elements.Add(new ZplTextBlock(sampleText, 10, 600, 400, 100, font));

            var renderEngine = new ZplEngine(elements);
            var output       = renderEngine.ToZplString(new ZplRenderOptions {
                AddEmptyLineBeforeElementStart = true
            });

            Debug.WriteLine(output);
        }
Пример #4
0
        static string RenderLabel6()
        {
            var text  = "Lorem Ipsum is simply dummy text\nof the printing and typesetting industry.\nLorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book";
            var font1 = new ZplFont(fontWidth: 0, fontHeight: 20, fontName: "0");
            var font2 = new ZplFont(fontWidth: 0, fontHeight: 13, fontName: "0");

            var elements = new ZplElementBase[]
            {
                new ZplTextBlock(text, 10, 0, 400, 100, font1, NewLineConversionMethod.ToSpace),
                new ZplTextBlock(text, 10, 120, 400, 100, font1, NewLineConversionMethod.ToSpace),

                new ZplTextBlock(text, 10, 240, 400, 100, font2, NewLineConversionMethod.ToEmpty),

                new ZplFieldBlock(text, 10, 360, 400, font1, 4)
            };

            var renderEngine = new ZplEngine(elements);

            return(renderEngine.ToZplString(new ZplRenderOptions
            {
                //AddEmptyLineBeforeElementStart = true,
                SourcePrintDpi = 203,
                TargetPrintDpi = 203
            }));
        }
Пример #5
0
        static string RenderLabel5()
        {
            var font1 = new ZplFont(fontWidth: 0, fontHeight: 50, fontName: "0");
            var font2 = new ZplFont(fontWidth: 0, fontHeight: 50, fontName: "1");
            var font3 = new ZplFont(fontWidth: 0, fontHeight: 80, fontName: "A");
            var font4 = new ZplFont(fontWidth: 0, fontHeight: 50, fontName: "B");
            var font5 = new ZplFont(fontWidth: 0, fontHeight: 20, fontName: "C");
            var font6 = new ZplFont(fontWidth: 20, fontHeight: 0, fontName: "D");
            var font7 = new ZplFont(fontWidth: 20, fontHeight: 20, fontName: "D");
            var font8 = new ZplFont(fontWidth: 20, fontHeight: 0, fontName: "D", fieldOrientation: FieldOrientation.Rotated90);

            var elements = new ZplElementBase[]
            {
                new ZplTextField("Font1 Demo Text", 10, 0, font1),
                new ZplTextField("Font2 Demo Text", 10, 100, font2),
                new ZplTextField("Font3 Demo Text", 10, 200, font3),
                new ZplTextField("Font4 Demo Text", 10, 300, font4),
                new ZplTextField("Font5 Demo Text", 10, 400, font5),
                new ZplTextField("Font6 Demo Text", 10, 500, font6),
                new ZplTextField("Font7 Demo Text", 10, 600, font7),
                new ZplTextField("Font8 Demo Text", 900, 10, font8),
            };

            var renderEngine = new ZplEngine(elements);

            return(renderEngine.ToZplString(new ZplRenderOptions
            {
                //AddEmptyLineBeforeElementStart = true,
                SourcePrintDpi = 203,
                TargetPrintDpi = 203
            }));
        }
Пример #6
0
        public void DownloadObjects()
        {
            var imageData = File.ReadAllBytes("Zpl.png");

            var elements = new List <ZplElementBase>
            {
                new ZplGraphicBox(0, 0, 100, 100, 4),
                new ZplDownloadObjects('R', "SAMPLE.PNG", imageData),
                new ZplImageMove(100, 100, 'R', "SAMPLE", "PNG")
            };

            var renderEngine = new ZplEngine(elements);
            var output       = renderEngine.ToZplString(new ZplRenderOptions
            {
                AddEmptyLineBeforeElementStart = true,
                TargetPrintDpi = 300,
                SourcePrintDpi = 200
            });

            Debug.WriteLine(output);
            Assert.IsNotNull(output);

            var zplData = File.ReadAllText("DownloadObject.txt");

            Assert.AreEqual(zplData, output);
        }
Пример #7
0
        public void RenderComments()
        {
            var elements = new List <ZplElementBase>();

            var textField = new ZplTextField("AAA", 50, 100, ZplConstants.Font.Default);

            textField.Comments.Add("A important field");
            elements.Add(textField);

            var renderEngine = new ZplEngine(elements);
            var output       = renderEngine.ToZplString(new ZplRenderOptions {
                DisplayComments = true
            });

            Debug.WriteLine(output);
        }
Пример #8
0
        static string RenderLabel2()
        {
            var elements = new ZplElementBase[]
            {
                new ZplReferenceGrid(),
            };

            var renderEngine = new ZplEngine(elements);

            return(renderEngine.ToZplString(new ZplRenderOptions
            {
                //AddEmptyLineBeforeElementStart = true,
                SourcePrintDpi = 203,
                TargetPrintDpi = 203
            }));
        }
Пример #9
0
        public void BarcodeEan13()
        {
            var elements = new List <ZplElementBase>
            {
                new ZplBarcodeEan13("123456", 100, 300)
            };

            var renderEngine = new ZplEngine(elements);
            var output       = renderEngine.ToZplString(new ZplRenderOptions {
                AddEmptyLineBeforeElementStart = true
            });

            Debug.WriteLine(output);
            Assert.IsNotNull(output);
            Assert.AreEqual("^XA\n^LH0,0\n^CI28\n\n^FO100,300\n^BEN,100,Y,N\n^FD123456^FS\n^XZ", output);
        }
Пример #10
0
        static string RenderLabel4()
        {
            var elements = new ZplElementBase[]
            {
                new ZplDownloadGraphics('R', "TEST", File.ReadAllBytes("logo_sw.png")),
                new ZplRecallGraphic(0, 0, 'R', "TEST")
            };

            var renderEngine = new ZplEngine(elements);

            return(renderEngine.ToZplString(new ZplRenderOptions
            {
                //AddEmptyLineBeforeElementStart = true,
                SourcePrintDpi = 203,
                TargetPrintDpi = 203
            }));
        }
Пример #11
0
        public void WithoutAutoElements()
        {
            var elements = new List <ZplElementBase>();

            var textField = new ZplTextField("Pure element zpl only", 50, 100, ZplConstants.Font.Default);

            textField.Comments.Add("A important field");
            elements.Add(textField);

            var renderEngine = new ZplEngine(elements);
            var output       = renderEngine.ToZplString(new ZplRenderOptions {
                DisplayComments = true, AddDefaultLabelHome = false, AddStartEndFormat = false
            });

            Debug.WriteLine(output);
            Assert.IsNotNull(output);
            Assert.AreEqual("^CI28\n^FX\n//A important field\n^A0N,30,30\n^FO50,100\n^FH^FDPure element zpl only^FS", output);
        }
Пример #12
0
        static string RenderLabel3()
        {
            var elements = new ZplElementBase[]
            {
                new ZplBarcode128("Barcode128", 10, 0),
                new ZplBarcode39("Barcode39", 10, 150),
                new ZplBarcodeAnsiCodabar("123456", 'a', 'd', 10, 300, 100),
                new ZplBarcodeEan13("123456789", 10, 450),
                new ZplBarcodeInterleaved2of5("123456789", 10, 600),
                new ZplQrCode("BinaryKits ZplUtility BinaryKits ZplUtility BinaryKits ZplUtility", 10, 800, magnificationFactor: 6)
            };

            var renderEngine = new ZplEngine(elements);

            return(renderEngine.ToZplString(new ZplRenderOptions
            {
                //AddEmptyLineBeforeElementStart = true,
                SourcePrintDpi = 203,
                TargetPrintDpi = 203
            }));
        }