You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlgraphics.apache.org by "matthias8283 (via GitHub)" <gi...@apache.org> on 2025/10/26 00:56:52 UTC

[PR] FOP-3273: PDF accessibility tagging stops after first fo/page-sequence [xmlgraphics-fop]

matthias8283 opened a new pull request, #96:
URL: https://github.com/apache/xmlgraphics-fop/pull/96

   See https://issues.apache.org/jira/browse/FOP-3273


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org


Re: [PR] FOP-3273: PDF accessibility tagging stops after first fo/page-sequence [xmlgraphics-fop]

Posted by "matthias8283 (via GitHub)" <gi...@apache.org>.
matthias8283 commented on code in PR #96:
URL: https://github.com/apache/xmlgraphics-fop/pull/96#discussion_r2467472753


##########
fop-core/src/test/java/org/apache/fop/accessibility/pdf/TaggingTestCase.java:
##########
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.accessibility.pdf;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.sax.SAXResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
+import org.apache.pdfbox.Loader;
+import org.apache.pdfbox.pdmodel.PDDocument;
+import org.apache.pdfbox.pdmodel.documentinterchange.markedcontent.PDMarkedContent;
+import org.apache.pdfbox.text.PDFMarkedContentExtractor;
+
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.apps.Fop;
+import org.apache.fop.apps.FopFactory;
+import org.apache.fop.apps.MimeConstants;
+
+public class TaggingTestCase {
+
+    @Test
+    public void testMultipleStaticContentArtifact() throws FOPException,
+            TransformerException, IOException {
+        FopFactory fopFactory = FopFactory.newInstance(new File(".").toURI());
+        FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
+        foUserAgent.setAccessibility(true);
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out);
+        TransformerFactory factory = TransformerFactory.newInstance();
+        Transformer transformer = factory.newTransformer();
+
+        String fo = "<fo:root xmlns:fo=\"http://www.w3.org/1999/XSL/Format\" xmlns:svg=\"http://www.w3.org/2000/svg\">"

Review Comment:
   Ok, moved the test to that class.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org


Re: [PR] FOP-3273: PDF accessibility tagging stops after first fo/page-sequence [xmlgraphics-fop]

Posted by "simonsteiner1984 (via GitHub)" <gi...@apache.org>.
simonsteiner1984 commented on code in PR #96:
URL: https://github.com/apache/xmlgraphics-fop/pull/96#discussion_r2463381758


##########
fop-core/src/test/java/org/apache/fop/accessibility/pdf/TaggingTestCase.java:
##########
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.accessibility.pdf;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.sax.SAXResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
+import org.apache.pdfbox.Loader;
+import org.apache.pdfbox.pdmodel.PDDocument;
+import org.apache.pdfbox.pdmodel.documentinterchange.markedcontent.PDMarkedContent;
+import org.apache.pdfbox.text.PDFMarkedContentExtractor;
+
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.apps.Fop;
+import org.apache.fop.apps.FopFactory;
+import org.apache.fop.apps.MimeConstants;
+
+public class TaggingTestCase {
+
+    @Test
+    public void testMultipleStaticContentArtifact() throws FOPException,
+            TransformerException, IOException {
+        FopFactory fopFactory = FopFactory.newInstance(new File(".").toURI());
+        FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
+        foUserAgent.setAccessibility(true);
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out);
+        TransformerFactory factory = TransformerFactory.newInstance();
+        Transformer transformer = factory.newTransformer();
+
+        String fo = "<fo:root xmlns:fo=\"http://www.w3.org/1999/XSL/Format\" xmlns:svg=\"http://www.w3.org/2000/svg\">"

Review Comment:
   normally we use FO2StructureTreeConverterTestCase



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org


Re: [PR] FOP-3273: PDF accessibility tagging stops after first fo/page-sequence [xmlgraphics-fop]

Posted by "matthias8283 (via GitHub)" <gi...@apache.org>.
matthias8283 commented on code in PR #96:
URL: https://github.com/apache/xmlgraphics-fop/pull/96#discussion_r2471449253


##########
fop-core/src/test/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverterTestCase.java:
##########
@@ -242,6 +253,83 @@ public void testSVGArtifact() throws Exception {
                 + "</structure-tree-sequence>");
     }
 
+    @Test
+    public void testMultipleStaticContentArtifact() throws FOPException,
+            TransformerException, IOException {
+        FopFactory fopFactory = FopFactory.newInstance(new File(".").toURI());
+        FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
+        foUserAgent.setAccessibility(true);
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out);
+        TransformerFactory factory = TransformerFactory.newInstance();
+        Transformer transformer = factory.newTransformer();
+
+        String fo = "<fo:root xmlns:fo=\"http://www.w3.org/1999/XSL/Format\" xmlns:svg=\"http://www.w3.org/2000/svg\">"
+                + "  <fo:layout-master-set>\n"
+                + "    <fo:simple-page-master page-width=\"8.5in\" page-height=\"11in\" master-name=\"Page\">\n"
+                + "      <fo:region-body region-name=\"Body\"/>\n"
+                + "      <fo:region-before region-name=\"xsl-region-before\" extent=\"0.5in\"/>\n"
+                + "    </fo:simple-page-master>\n"
+                + "  </fo:layout-master-set>\n"
+                + "  <fo:page-sequence master-reference=\"Page\">\n"
+                + "    <fo:static-content flow-name=\"xsl-region-before\" role=\"artifact\">\n"
+                + "      <fo:block>\n"
+                + "        <fo:retrieve-marker retrieve-class-name=\"headline-current\"/>\n"
+                + "      </fo:block>\n"
+                + "    </fo:static-content>\n"
+                + "    <fo:flow flow-name=\"Body\">\n"
+                + "      <fo:block>\n"
+                + "        <fo:marker marker-class-name=\"headline-current\">1</fo:marker>\n"
+                + "        <fo:block>A</fo:block>\n"
+                + "      </fo:block>\n"
+                + "    </fo:flow>\n"
+                + "  </fo:page-sequence>\n"
+                + "  <fo:page-sequence master-reference=\"Page\">\n"
+                + "    <fo:static-content flow-name=\"xsl-region-before\" role=\"artifact\">\n"
+                + "      <fo:block>\n"
+                + "        <fo:retrieve-marker retrieve-class-name=\"headline-current\"/>\n"
+                + "      </fo:block>\n"
+                + "    </fo:static-content>\n"
+                + "    <fo:flow flow-name=\"Body\">\n"
+                + "      <fo:block>\n"
+                + "        <fo:marker marker-class-name=\"headline-current\">2</fo:marker>\n"
+                + "        <fo:block>B</fo:block>\n"
+                + "      </fo:block>\n"
+                + "    </fo:flow>\n"
+                + "  </fo:page-sequence>\n"
+                + "</fo:root>";
+        Source src = new StreamSource(new ByteArrayInputStream(fo.getBytes()));

Review Comment:
   No, because the structure XML fragment doesn't contain any tag/role information, therefore I can't validate if a fo:block will be tagged as "P" or "Artifact".



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org


Re: [PR] FOP-3273: PDF accessibility tagging stops after first fo/page-sequence [xmlgraphics-fop]

Posted by "simonsteiner1984 (via GitHub)" <gi...@apache.org>.
simonsteiner1984 commented on code in PR #96:
URL: https://github.com/apache/xmlgraphics-fop/pull/96#discussion_r2468133982


##########
fop-core/src/test/java/org/apache/fop/accessibility/fo/FO2StructureTreeConverterTestCase.java:
##########
@@ -242,6 +253,83 @@ public void testSVGArtifact() throws Exception {
                 + "</structure-tree-sequence>");
     }
 
+    @Test
+    public void testMultipleStaticContentArtifact() throws FOPException,
+            TransformerException, IOException {
+        FopFactory fopFactory = FopFactory.newInstance(new File(".").toURI());
+        FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
+        foUserAgent.setAccessibility(true);
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out);
+        TransformerFactory factory = TransformerFactory.newInstance();
+        Transformer transformer = factory.newTransformer();
+
+        String fo = "<fo:root xmlns:fo=\"http://www.w3.org/1999/XSL/Format\" xmlns:svg=\"http://www.w3.org/2000/svg\">"
+                + "  <fo:layout-master-set>\n"
+                + "    <fo:simple-page-master page-width=\"8.5in\" page-height=\"11in\" master-name=\"Page\">\n"
+                + "      <fo:region-body region-name=\"Body\"/>\n"
+                + "      <fo:region-before region-name=\"xsl-region-before\" extent=\"0.5in\"/>\n"
+                + "    </fo:simple-page-master>\n"
+                + "  </fo:layout-master-set>\n"
+                + "  <fo:page-sequence master-reference=\"Page\">\n"
+                + "    <fo:static-content flow-name=\"xsl-region-before\" role=\"artifact\">\n"
+                + "      <fo:block>\n"
+                + "        <fo:retrieve-marker retrieve-class-name=\"headline-current\"/>\n"
+                + "      </fo:block>\n"
+                + "    </fo:static-content>\n"
+                + "    <fo:flow flow-name=\"Body\">\n"
+                + "      <fo:block>\n"
+                + "        <fo:marker marker-class-name=\"headline-current\">1</fo:marker>\n"
+                + "        <fo:block>A</fo:block>\n"
+                + "      </fo:block>\n"
+                + "    </fo:flow>\n"
+                + "  </fo:page-sequence>\n"
+                + "  <fo:page-sequence master-reference=\"Page\">\n"
+                + "    <fo:static-content flow-name=\"xsl-region-before\" role=\"artifact\">\n"
+                + "      <fo:block>\n"
+                + "        <fo:retrieve-marker retrieve-class-name=\"headline-current\"/>\n"
+                + "      </fo:block>\n"
+                + "    </fo:static-content>\n"
+                + "    <fo:flow flow-name=\"Body\">\n"
+                + "      <fo:block>\n"
+                + "        <fo:marker marker-class-name=\"headline-current\">2</fo:marker>\n"
+                + "        <fo:block>B</fo:block>\n"
+                + "      </fo:block>\n"
+                + "    </fo:flow>\n"
+                + "  </fo:page-sequence>\n"
+                + "</fo:root>";
+        Source src = new StreamSource(new ByteArrayInputStream(fo.getBytes()));

Review Comment:
   can you use the compare method



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org


Re: [PR] FOP-3273: PDF accessibility tagging stops after first fo/page-sequence [xmlgraphics-fop]

Posted by "matthias8283 (via GitHub)" <gi...@apache.org>.
matthias8283 merged PR #96:
URL: https://github.com/apache/xmlgraphics-fop/pull/96


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org