From f7327188523af9ce1a79efbc1c5989ad4675e15c Mon Sep 17 00:00:00 2001 From: EliotJones Date: Sun, 15 Feb 2026 12:31:27 -0400 Subject: [PATCH] both Tj and TJ operators should increment text sequence #1241 the text sequence was added to group letters added by the same content stream operation together for layout analysis. TJ allows for individual letter positioning in the same operation which modifies the text matrix while writing whereas Tj just writes the text at the current location. both should be semantically equivalent for this sequence number. this was originally added in #61 --- src/UglyToad.PdfPig/Graphics/BaseStreamProcessor.cs | 2 ++ src/UglyToad.PdfPig/Graphics/Operations/TextShowing/ShowText.cs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/UglyToad.PdfPig/Graphics/BaseStreamProcessor.cs b/src/UglyToad.PdfPig/Graphics/BaseStreamProcessor.cs index 17502c48..f72f3ddf 100644 --- a/src/UglyToad.PdfPig/Graphics/BaseStreamProcessor.cs +++ b/src/UglyToad.PdfPig/Graphics/BaseStreamProcessor.cs @@ -215,6 +215,8 @@ /// public void ShowText(IInputBytes bytes) { + TextSequence++; + var currentState = GetCurrentState(); var font = currentState.FontState.FromExtendedGraphicsState diff --git a/src/UglyToad.PdfPig/Graphics/Operations/TextShowing/ShowText.cs b/src/UglyToad.PdfPig/Graphics/Operations/TextShowing/ShowText.cs index fd9ed9c2..7072b3db 100644 --- a/src/UglyToad.PdfPig/Graphics/Operations/TextShowing/ShowText.cs +++ b/src/UglyToad.PdfPig/Graphics/Operations/TextShowing/ShowText.cs @@ -64,7 +64,7 @@ operationContext.ShowText(input); } - string? EscapeText(string? text) + private static string? EscapeText(string? text) { if (text is null) return null; // Fix Issue 350 from PDF Spec 1.7 (page 408) on handling 'special characters' of '(', ')' and '\'.