コード例 #1
0
        protected virtual void GetPosition([NotNull] T svgElement,
                                           [NotNull] Matrix sourceMatrix,
                                           [NotNull] Matrix viewMatrix,
                                           out int horizontalStart,
                                           out int verticalStart,
                                           out FieldOrientation fieldOrientation,
                                           out float fontSize)
        {
            if (svgElement == null)
            {
                throw new ArgumentNullException(nameof(svgElement));
            }
            if (sourceMatrix == null)
            {
                throw new ArgumentNullException(nameof(sourceMatrix));
            }
            if (viewMatrix == null)
            {
                throw new ArgumentNullException(nameof(viewMatrix));
            }

            this.ZplTransformer.Transform(svgElement,
                                          sourceMatrix,
                                          viewMatrix,
                                          out var x,
                                          out var y,
                                          out fontSize);

            horizontalStart  = (int)x;
            verticalStart    = (int)y;
            fieldOrientation = this.ZplTransformer.GetFieldOrientation(sourceMatrix,
                                                                       viewMatrix);
        }
コード例 #2
0
        /// <exception cref="ArgumentNullException"><paramref name="svgElement" /> is <see langword="null" />.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="fontName" /> is <see langword="null" />.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="text" /> is <see langword="null" />.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="zplContainer" /> is <see langword="null" />.</exception>
        protected virtual void AddTranslationToContainer([NotNull] T svgElement,
                                                         int horizontalStart,
                                                         int verticalStart,
                                                         [NotNull] string fontName,
                                                         FieldOrientation fieldOrientation,
                                                         int characterHeight,
                                                         int width,
                                                         [NotNull] string text,
                                                         [NotNull] ZplContainer zplContainer)
        {
            if (fontName == null)
            {
                throw new ArgumentNullException(nameof(fontName));
            }
            if (text == null)
            {
                throw new ArgumentNullException(nameof(text));
            }
            if (zplContainer == null)
            {
                throw new ArgumentNullException(nameof(zplContainer));
            }

            zplContainer.Body.Add(this.ZplCommands.FieldTypeset(horizontalStart,
                                                                verticalStart));
            zplContainer.Body.Add(this.ZplCommands.Font(fontName,
                                                        fieldOrientation,
                                                        characterHeight,
                                                        width,
                                                        text));
        }
コード例 #3
0
 /// <summary>
 /// EAN-13 Barcode
 /// </summary>
 /// <param name="content"></param>
 /// <param name="positionX"></param>
 /// <param name="positionY"></param>
 /// <param name="height"></param>
 /// <param name="moduleWidth"></param>
 /// <param name="wideBarToNarrowBarWidthRatio"></param>
 /// <param name="fieldOrientation"></param>
 /// <param name="printInterpretationLine"></param>
 /// <param name="printInterpretationLineAboveCode"></param>
 /// <param name="bottomToTop"></param>
 public ZplBarcodeEan13(
     string content,
     int positionX,
     int positionY,
     int height      = 100,
     int moduleWidth = 2,
     double wideBarToNarrowBarWidthRatio   = 3,
     FieldOrientation fieldOrientation     = FieldOrientation.Normal,
     bool printInterpretationLine          = true,
     bool printInterpretationLineAboveCode = false,
     bool bottomToTop = false)
     : base(content,
            positionX,
            positionY,
            height,
            moduleWidth,
            wideBarToNarrowBarWidthRatio,
            fieldOrientation,
            printInterpretationLine,
            printInterpretationLineAboveCode,
            bottomToTop)
 {
     if (!IsDigitsOnly(content))
     {
         throw new ArgumentException("EAN-13 Barcode allow only digits", nameof(content));
     }
 }
コード例 #4
0
 public FontInfo(string fontName, FieldOrientation fieldOrientation, int fontWidth, int fontHeight)
 {
     this.FontName         = fontName;
     this.FieldOrientation = fieldOrientation;
     this.FontWidth        = fontWidth;
     this.FontHeight       = fontHeight;
 }
コード例 #5
0
 /// <summary>
 /// Code 39 Barcode
 /// </summary>
 /// <param name="content"></param>
 /// <param name="positionX"></param>
 /// <param name="positionY"></param>
 /// <param name="height"></param>
 /// <param name="moduleWidth"></param>
 /// <param name="wideBarToNarrowBarWidthRatio"></param>
 /// <param name="fieldOrientation"></param>
 /// <param name="printInterpretationLine"></param>
 /// <param name="printInterpretationLineAboveCode"></param>
 /// <param name="mod43CheckDigit"></param>
 /// <param name="bottomToTop"></param>
 public ZplBarcode39(
     string content,
     int positionX,
     int positionY,
     int height      = 100,
     int moduleWidth = 2,
     double wideBarToNarrowBarWidthRatio   = 3,
     FieldOrientation fieldOrientation     = FieldOrientation.Normal,
     bool printInterpretationLine          = true,
     bool printInterpretationLineAboveCode = false,
     bool mod43CheckDigit = false,
     bool bottomToTop     = false)
     : base(content,
            positionX,
            positionY,
            height,
            moduleWidth,
            wideBarToNarrowBarWidthRatio,
            fieldOrientation,
            printInterpretationLine,
            printInterpretationLineAboveCode,
            bottomToTop)
 {
     Mod43CheckDigit = mod43CheckDigit;
 }
コード例 #6
0
 public void SetNextFont(
     string fontName,
     FieldOrientation fieldOrientation,
     int fontWidth,
     int fontHeight)
 {
     this.NextFont = new FontInfo(fontName, fieldOrientation, fontWidth, fontHeight);
 }
コード例 #7
0
ファイル: ZplFont.cs プロジェクト: BinaryKits/ZPLUtility
 public ZplFont(
     int fontWidth   = 30,
     int fontHeight  = 30,
     string fontName = "0",
     FieldOrientation fieldOrientation = FieldOrientation.Normal)
 {
     FontName         = fontName;
     FieldOrientation = fieldOrientation;
     FontWidth        = fontWidth;
     FontHeight       = fontHeight;
 }
コード例 #8
0
 /// <summary>
 /// Data Matrix Bar Code
 /// </summary>
 /// <param name="content"></param>
 /// <param name="positionX"></param>
 /// <param name="positionY"></param>
 /// <param name="height"></param>
 /// <param name="fieldOrientation"></param>
 /// <param name="bottomToTop"></param>
 public ZplDataMatrix(
     string content,
     int positionX,
     int positionY,
     int height = 100,
     FieldOrientation fieldOrientation = FieldOrientation.Normal,
     bool bottomToTop = false
     )
     : base(positionX, positionY, bottomToTop)
 {
     Content          = content;
     FieldOrientation = fieldOrientation;
     Height           = height;
 }
コード例 #9
0
        public virtual string Code39BarCode(FieldOrientation fieldOrientation,
                                            int barCodeHeight,
                                            [NotNull] string content,
                                            PrintInterpretationLine printInterpretationLine = PrintInterpretationLine.Yes,
                                            PrintInterpretationLineAboveCode printInterpretationLineAboveCode = PrintInterpretationLineAboveCode.No,
                                            Mod43Check mod43Check = Mod43Check.No)
        {
            if (content == null)
            {
                throw new ArgumentNullException(nameof(content));
            }

            return($"^B3{(char) fieldOrientation},{(char) mod43Check},{barCodeHeight},{(char) printInterpretationLine},{(char) printInterpretationLineAboveCode}^FD{content}^FS");
        }
コード例 #10
0
        public virtual string Interleaved2Of5BarCode(FieldOrientation fieldOrientation,
                                                     int barCodeHeight,
                                                     [NotNull] string content,
                                                     PrintInterpretationLine printInterpretationLine = PrintInterpretationLine.Yes,
                                                     PrintInterpretationLineAboveCode printInterpretationLineAboveCode = PrintInterpretationLineAboveCode.No,
                                                     CalculateAndPrintMod10CheckDigit calculateAndPrintMod10CheckDigit = CalculateAndPrintMod10CheckDigit.No)
        {
            if (content == null)
            {
                throw new ArgumentNullException(nameof(content));
            }

            return($"^B2{(char) fieldOrientation},{barCodeHeight},{(char) printInterpretationLine},{(char) printInterpretationLineAboveCode},{(char) calculateAndPrintMod10CheckDigit}^FD{content}^FS");
        }
コード例 #11
0
 public ZplGraphicSymbol(
     GraphicSymbolCharacter character,
     int positionX,
     int positionY,
     int width,
     int height,
     FieldOrientation fieldOrientation = FieldOrientation.Normal)
     : base(positionX, positionY)
 {
     Character        = character;
     FieldOrientation = fieldOrientation;
     Width            = width;
     Height           = height;
 }
コード例 #12
0
        public virtual string Code128BarCode(FieldOrientation fieldOrientation,
                                             int barCodeHeight,
                                             [NotNull] string content,
                                             PrintInterpretationLine printInterpretationLine = PrintInterpretationLine.Yes,
                                             PrintInterpretationLineAboveCode printInterpretationLineAboveCode = PrintInterpretationLineAboveCode.No,
                                             UccCheckDigit uccCheckDigit = UccCheckDigit.No,
                                             Mode mode = Mode.NoSelectedMode)
        {
            if (content == null)
            {
                throw new ArgumentNullException(nameof(content));
            }

            return($"^BC{(char) fieldOrientation},{barCodeHeight},{(char) printInterpretationLine},{(char) printInterpretationLineAboveCode},{(char) uccCheckDigit},{(char) mode}^FD{content}^FS");
        }
コード例 #13
0
        public virtual string AztecBarCode(FieldOrientation fieldOrientation,
                                           int magnificationFactor,
                                           [NotNull] string content,
                                           ExtendedChannelInterpretationCodeIndicator extendedChannelInterpretationCodeIndicator = ExtendedChannelInterpretationCodeIndicator.No,
                                           int errorControlAndSymbolSizeTypeIndictaor = 0,
                                           MenuSymbolIndicator menuSymbolIndicator    = MenuSymbolIndicator.No,
                                           int numberOfSymbolsForStructuredAppend     = 1)
        {
            if (content == null)
            {
                throw new ArgumentNullException(nameof(content));
            }

            return($"^B0{(char) fieldOrientation},{magnificationFactor},{(char) extendedChannelInterpretationCodeIndicator},{errorControlAndSymbolSizeTypeIndictaor},{(char) menuSymbolIndicator},{numberOfSymbolsForStructuredAppend}^FD{content}^FS");
        }
コード例 #14
0
        public virtual string Font([NotNull] string fontName,
                                   FieldOrientation fieldOrientation,
                                   int characterHeight,
                                   int width,
                                   [NotNull] string text)
        {
            if (fontName == null)
            {
                throw new ArgumentNullException(nameof(fontName));
            }
            if (text == null)
            {
                throw new ArgumentNullException(nameof(text));
            }

            return($"^A{fontName}{(char) fieldOrientation},{characterHeight},{width}^FD{text}^FS");
        }
コード例 #15
0
        public string RenderFieldOrientation(FieldOrientation fieldOrientation)
        {
            switch (fieldOrientation)
            {
            case FieldOrientation.Normal:
                return("N");

            case FieldOrientation.Rotated90:
                return("R");

            case FieldOrientation.Rotated180:
                return("I");

            case FieldOrientation.Rotated270:
                return("B");
            }

            throw new NotImplementedException("Unknown Field Orientation");
        }
コード例 #16
0
 public ZplBarcode(
     string content,
     int positionX,
     int positionY,
     int height,
     int moduleWidth,
     double wideBarToNarrowBarWidthRatio,
     FieldOrientation fieldOrientation,
     bool printInterpretationLine,
     bool printInterpretationLineAboveCode,
     bool bottomToTop = false)
     : base(positionX, positionY, bottomToTop)
 {
     Content     = content;
     Height      = height;
     ModuleWidth = moduleWidth;
     WideBarToNarrowBarWidthRatio     = wideBarToNarrowBarWidthRatio;
     FieldOrientation                 = fieldOrientation;
     PrintInterpretationLine          = printInterpretationLine;
     PrintInterpretationLineAboveCode = printInterpretationLineAboveCode;
 }
コード例 #17
0
        /// <summary>
        /// Ansi Codabar Barcode
        /// </summary>
        /// <param name="content"></param>
        /// <param name="startCharacter">A,B,C,D</param>
        /// <param name="stopCharacter">A,B,C,D</param>
        /// <param name="positionX"></param>
        /// <param name="positionY"></param>
        /// <param name="height"></param>
        /// <param name="moduleWidth"></param>
        /// <param name="wideBarToNarrowBarWidthRatio"></param>
        /// <param name="fieldOrientation"></param>
        /// <param name="printInterpretationLine"></param>
        /// <param name="printInterpretationLineAboveCode"></param>
        /// <param name="checkDigit"></param>
        /// <param name="bottomToTop"></param>
        public ZplBarcodeAnsiCodabar(
            string content,
            char startCharacter,
            char stopCharacter,
            int positionX,
            int positionY,
            int height      = 100,
            int moduleWidth = 2,
            double wideBarToNarrowBarWidthRatio   = 3,
            FieldOrientation fieldOrientation     = FieldOrientation.Normal,
            bool printInterpretationLine          = true,
            bool printInterpretationLineAboveCode = false,
            bool checkDigit  = false,
            bool bottomToTop = false)
            : base(content,
                   positionX,
                   positionY,
                   height,
                   moduleWidth,
                   wideBarToNarrowBarWidthRatio,
                   fieldOrientation,
                   printInterpretationLine,
                   printInterpretationLineAboveCode,
                   bottomToTop)
        {
            if (!IsValidCharacter(startCharacter))
            {
                throw new InvalidOperationException("ANSI Codabar start charactor must be one of A, B, C, D");
            }

            if (!IsValidCharacter(stopCharacter))
            {
                throw new InvalidOperationException("ANSI Codabar stop charactor must be one of A, B, C, D");
            }

            CheckDigit     = checkDigit;
            StartCharacter = char.ToUpper(startCharacter);
            StopCharacter  = char.ToUpper(stopCharacter);
        }
コード例 #18
0
ファイル: FontDefinition.cs プロジェクト: azanov/FluentZpl
 public FontDefinition SetOrientation(FieldOrientation orientation)
 {
     _orientation = orientation;
     return this;
 }
コード例 #19
0
ファイル: FontDefinition.cs プロジェクト: azanov/FluentZpl
 public FontDefinition(string fontType,  int size)
 {
     Height = size;
     FontType = fontType;
     _orientation = FieldOrientation.Normal;
 }
コード例 #20
0
 public bool ShouldSerializeFieldOrientation() =>
 SerializeDefaults ||
 !FieldOrientation.Equals(ZPLForgeDefaults.Elements.Symbol.FieldOrientation);
コード例 #21
0
 public LabelTextGenerator SetFont(string type, FieldOrientation orientation, int size)
 {
     _font = new FontDefinition(type, size);
     _font.SetOrientation(orientation);
     return this;
 }