Skip to content

Commit 1e72b57

Browse files
Refactor interfaces in com.itextpdf.kernel.pdf.tagutils package
Replaced IAccessibleElement+AccessibilityProperties with AccessibilityProperties abstract class; Old AccessibilityProperties class is replaced with DefaultAccessibilityProperties implementation of abstract class; Changed most of the API that concerns tag roles in order to make it work with java strings; Introduced separate StandardRoles class for possible role constants; Introduced PdfStructureAttributes wrapper for structure attributes. DEVSIX-1236 Autoported commit. Original commit hash: [4237de6b10]
1 parent dfc34e9 commit 1e72b57

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1422
-943
lines changed

itext.tests/itext.forms.tests/itext/forms/FormFieldsTaggingTest.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ source product.
4444
using iText.Forms.Fields;
4545
using iText.Kernel.Geom;
4646
using iText.Kernel.Pdf;
47+
using iText.Kernel.Pdf.Tagging;
4748
using iText.Kernel.Pdf.Tagutils;
4849
using iText.Kernel.Utils;
4950
using iText.Test;
@@ -189,7 +190,7 @@ public virtual void FormFieldTaggingTest07() {
189190
PdfButtonFormField pushButton = PdfFormField.CreatePushButton(pdfDoc, new Rectangle(36, 650, 40, 20), "push"
190191
, "Capcha");
191192
TagTreePointer tagPointer = pdfDoc.GetTagStructureContext().GetAutoTaggingPointer();
192-
tagPointer.MoveToKid(PdfName.Div);
193+
tagPointer.MoveToKid(StandardRoles.DIV);
193194
acroForm.AddField(pushButton);
194195
pdfDoc.Close();
195196
CompareOutput(outFileName, cmpFileName);

itext.tests/itext.kernel.tests/itext/kernel/pdf/PdfStringTest.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ source product.
5050
using iText.Kernel.Pdf.Canvas;
5151
using iText.Kernel.Pdf.Canvas.Parser;
5252
using iText.Kernel.Pdf.Canvas.Parser.Listener;
53+
using iText.Kernel.Pdf.Tagging;
5354
using iText.Kernel.Pdf.Tagutils;
5455
using iText.Kernel.Utils;
5556
using iText.Test;
@@ -192,8 +193,8 @@ public virtual void WriteUtf8AltText() {
192193
PdfCanvas canvas = new PdfCanvas(page);
193194
TagTreePointer tagPointer = new TagTreePointer(pdfDoc);
194195
tagPointer.SetPageForTagging(page);
195-
tagPointer.AddTag(PdfName.Div);
196-
tagPointer.AddTag(PdfName.Span);
196+
tagPointer.AddTag(StandardRoles.DIV);
197+
tagPointer.AddTag(StandardRoles.SPAN);
197198
// 2001: A Space Odyssey (Космическая одиссея)
198199
tagPointer.GetContext().GetPointerStructElem(tagPointer).SetAlt(new PdfString("2001: A Space Odyssey (\u041A\u043E\u0441\u043C\u0438\u0447\u0435\u0441\u043A\u0430\u044F "
199200
+ "\u043E\u0434\u0438\u0441\u0441\u0435\u044F)", PdfEncodings.UTF8));
@@ -274,8 +275,8 @@ public virtual void WriteUtf8ActualText() {
274275
PdfCanvas canvas = new PdfCanvas(page);
275276
TagTreePointer tagPointer = new TagTreePointer(pdfDoc);
276277
tagPointer.SetPageForTagging(page);
277-
tagPointer.AddTag(PdfName.Div);
278-
tagPointer.AddTag(PdfName.Span);
278+
tagPointer.AddTag(StandardRoles.DIV);
279+
tagPointer.AddTag(StandardRoles.SPAN);
279280
tagPointer.GetContext().GetPointerStructElem(tagPointer).SetActualText(new PdfString("actual", PdfEncodings
280281
.UTF8));
281282
canvas.BeginText();

itext.tests/itext.kernel.tests/itext/kernel/pdf/PdfStructElemTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ public virtual void StructElemTest07() {
342342
span1.AddRef(span2);
343343
span1.SetPhoneticAlphabet(PdfName.ipa);
344344
span1.SetPhoneme(new PdfString("Heeeelllloooooo"));
345-
@namespace.AddNamespaceRoleMapping(PdfName.Span, PdfName.Span);
345+
@namespace.AddNamespaceRoleMapping(StandardRoles.SPAN, StandardRoles.SPAN);
346346
document.GetStructTreeRoot().AddNamespace(@namespace);
347347
page.Flush();
348348
document.Close();

itext.tests/itext.kernel.tests/itext/kernel/pdf/TagTreePointerTest.cs

Lines changed: 92 additions & 73 deletions
Large diffs are not rendered by default.

itext.tests/itext.layout.tests/itext/layout/LayoutTaggingPdf2Test.cs

Lines changed: 97 additions & 97 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)