namespace UglyToad.PdfPig.Graphics.Operations.TextShowing { using System.IO; using TextPositioning; using TextState; using Util.JetBrains.Annotations; /// /// /// Move to the next line and show a text string, using the first number as the word spacing and the second as the character spacing /// public class MoveToNextLineShowTextWithSpacing : IGraphicsStateOperation { /// /// The symbol for this operation in a stream. /// public const string Symbol = "\""; /// public string Operator => Symbol; /// /// The word spacing. /// public decimal WordSpacing { get; } /// /// The character spacing. /// public decimal CharacterSpacing { get; } /// /// The bytes of the text. /// [CanBeNull] public byte[] Bytes { get; } /// /// The text to show. /// [CanBeNull] public string Text { get; } /// /// Create a new . /// /// The word spacing. /// The character spacing. /// The text to show. public MoveToNextLineShowTextWithSpacing(decimal wordSpacing, decimal characterSpacing, string text) { WordSpacing = wordSpacing; CharacterSpacing = characterSpacing; Text = text; } /// /// Create a new . /// /// The word spacing. /// The character spacing. /// The bytes of the text to show. public MoveToNextLineShowTextWithSpacing(decimal wordSpacing, decimal characterSpacing, byte[] hexBytes) { WordSpacing = wordSpacing; CharacterSpacing = characterSpacing; Bytes = hexBytes; } /// public void Run(IOperationContext operationContext) { var setWordSpacing = new SetWordSpacing(WordSpacing); var setCharacterSpacing = new SetCharacterSpacing(CharacterSpacing); var moveToNextLine = MoveToNextLine.Value; var showText = Text != null ? new ShowText(Text) : new ShowText(Bytes); setWordSpacing.Run(operationContext); setCharacterSpacing.Run(operationContext); moveToNextLine.Run(operationContext); showText.Run(operationContext); } /// public void Write(Stream stream) { throw new System.NotImplementedException(); } /// public override string ToString() { return $"{WordSpacing} {CharacterSpacing} {Text} {Symbol}"; } } }