Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDF/UA-1 validation: An annotation, excluding annotations of subtype Widget, PrinterMark or Link, shall be nested within an Annot tag #293

Open
Intelligent2013 opened this issue Sep 26, 2024 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@Intelligent2013
Copy link
Contributor

Source: #287

<rule specification="ISO 14289-1:2014" clause="7.18.1" testNumber="1" status="failed" failedChecks="2" tags="annotation">
	<description>An annotation, excluding annotations of subtype Widget, PrinterMark or Link, shall be nested within an Annot tag</description>
	<object>PDAnnot</object>
	<test>Subtype == 'Widget' || Subtype == 'PrinterMark' || Subtype == 'Link' || isOutsideCropBox == true || (F &amp; 2) == 2 || structParentStandardType == 'Annot'</test>
	<check status="failed">
		<context>root/document[0]/pages[3](12 0 obj PDPage)/annots[0](115 0 obj PDMarkupAnnot)</context>
	</check>
</rule>

PDF with errors:
iec-rice-en.presentation.pdf

@Intelligent2013 Intelligent2013 added the bug Something isn't working label Sep 26, 2024
@Intelligent2013 Intelligent2013 self-assigned this Sep 26, 2024
@github-project-automation github-project-automation bot moved this to 🆕 New in Metanorma Sep 26, 2024
@Intelligent2013
Copy link
Contributor Author

Additionally from #267 (comment):

If you run it through the veraPDF Docker and select the PDF/UA-1 conformance check, it notes that the File attachment annotation is not contained inside an Annot tag: "An annotation, excluding annotations of subtype Widget, PrinterMark or Link, shall be nested within an Annot tag"

@Intelligent2013
Copy link
Contributor Author

Currently, the annotation are adding via PDFBOX importing (XFDF) in https://github.com/metanorma/mn2pdf/blob/main/src/main/java/org/metanorma/fop/annotations/Annotation.java.
I don't figure out yet how to nested them within Annot tag. I'll think...

@Intelligent2013
Copy link
Contributor Author

I spent a few days but without success. I've asked here https://stackoverflow.com/questions/79083813/how-to-add-the-annotation-tag-in-tagged-pdf-using-pdfbox.

@petervwyatt
Copy link

Here is an example PDF file with a file attachment annot included in this structure tree of the page equivalent to where a sighted user might see the paperclip. Note that that the annot appearance stream (of the paperclip) is NOT required to be marked up (use MCIDs, etc) in PDF/UA-1 as the wording doesn't require it and the context is sufficient given that Desc and Contents entries should be presented by the AT.

PDF with attachment.pdf

@Intelligent2013
Copy link
Contributor Author

Here is an example PDF file with a file attachment annot included in this structure tree of the page equivalent to where a sighted user might see the paperclip. Note that that the annot appearance stream (of the paperclip) is NOT required to be marked up (use MCIDs, etc) in PDF/UA-1 as the wording doesn't require it and the context is sufficient given that Desc and Contents entries should be presented by the AT.

PDF with attachment.pdf

@petervwyatt thank you for the answer. But the initial issue relates to the 'comment' annotation, not 'file attachment'.
The Apache FOP doesn't support the comments, and I imports XFDF annotation via PDFBox API after the PDF generation (by Apache FOP).

Source PDF: tagged.pdf
XFDF: annotation.zip (attached .zip, because GH doesn't allow to attach .xfdf)

Current result - without 'Annot' in the tags tree (with error An annotation, excluding annotations of subtype Widget, PrinterMark or Link, shall be nested within an Annot tag):
tagged_with_annotation.pdf

Expected result - with Annot in the tags tree:
tagged_acrobat.pdf

I have to put the Annot tag into the existing tag tree and set the relationship between Annot and imported annotation, but I don't realized how to do this via PDFBox yet...

@Intelligent2013
Copy link
Contributor Author

The solution here. I'll update mn2pdf to apply it to all text annotation instances.

Intelligent2013 added a commit that referenced this issue Oct 31, 2024
Intelligent2013 added a commit that referenced this issue Oct 31, 2024
Intelligent2013 added a commit that referenced this issue Oct 31, 2024
Intelligent2013 added a commit that referenced this issue Oct 31, 2024
Intelligent2013 added a commit that referenced this issue Oct 31, 2024
Intelligent2013 added a commit that referenced this issue Nov 1, 2024
Intelligent2013 added a commit that referenced this issue Nov 1, 2024
Intelligent2013 added a commit to metanorma/mn-native-pdf that referenced this issue Nov 1, 2024
Intelligent2013 added a commit to metanorma/mn-native-pdf that referenced this issue Nov 1, 2024
Intelligent2013 added a commit to metanorma/mn-native-pdf that referenced this issue Nov 1, 2024
Intelligent2013 added a commit to metanorma/mn-native-pdf that referenced this issue Nov 1, 2024
Intelligent2013 added a commit to metanorma/mn-native-pdf that referenced this issue Nov 1, 2024
Intelligent2013 added a commit to metanorma/mn-native-pdf that referenced this issue Nov 1, 2024
Intelligent2013 added a commit to metanorma/mn-native-pdf that referenced this issue Nov 1, 2024
Intelligent2013 added a commit to metanorma/mn-native-pdf that referenced this issue Nov 1, 2024
Intelligent2013 added a commit to metanorma/mn-native-pdf that referenced this issue Nov 1, 2024
Intelligent2013 added a commit to metanorma/mn-native-pdf that referenced this issue Nov 1, 2024
Intelligent2013 added a commit to metanorma/mn-native-pdf that referenced this issue Nov 1, 2024
@Intelligent2013
Copy link
Contributor Author

mn2pdf updated for enclosing the text annotations into the Annot tag.

Also there is a case of /Subtype /Highlight annotation:

image

ValidationResult [flavour=ua1, totalAssertions=161267, assertions=[
TestAssertion [ruleId=RuleId [specification=ISO 14289-1:2014, clause=7.18.1, testNumber=2], status=failed,
message=An annotation (except Widget annotations or hidden annotations, or those having rectangle outside the crop-box) shall have either Contents key or an Alt entry in the enclosing structure element,
location=Location [level=CosDocument, context=root/document[0]/pages[10](19 0 obj PDPage)/annots[20](154 0 obj PDMarkupAnnot)], locationContext=null, errorMessage=null], 
TestAssertion [ruleId=RuleId [specification=ISO 14289-1:2014, clause=7.18.1, testNumber=1], status=failed,
message=An annotation, excluding annotations of subtype Widget, PrinterMark or Link, shall be nested within an Annot tag,
location=Location [level=CosDocument, context=root/document[0]/pages[10](19 0 obj PDPage)/annots[20](154 0 obj PDMarkupAnnot)], locationContext=null, errorMessage=null], 
TestAssertion [ruleId=RuleId [specification=ISO 14289-1:2014, clause=7.1, testNumber=3], status=failed,
message=Content shall be marked as Artifact or tagged as real content,
location=Location [level=CosDocument, context=root/document[0]/pages[10](19 0 obj PDPage)/annots[20](154 0 obj PDMarkupAnnot)/appearance[0]/contentStream[0](3028 0 obj PDContentStream)/operators[2]/xObject[0]/contentStream[0](3133 0 obj PDSemanticContentStream)/operators[0]/xObject[0]/contentStream[0](3194 0 obj PDSemanticContentStream)/content[0]/contentItem[0]], locationContext=null, errorMessage=null], 
TestAssertion [ruleId=RuleId [specification=ISO 14289-1:2014, clause=7.1, testNumber=3], status=failed,
message=Content shall be marked as Artifact or tagged as real content,
location=Location [level=CosDocument, context=root/document[0]/pages[10](19 0 obj PDPage)/annots[20](154 0 obj PDMarkupAnnot)/appearance[0]/contentStream[0](3028 0 obj PDContentStream)/operators[2]/xObject[0]/contentStream[0](3133 0 obj PDSemanticContentStream)/operators[0]/xObject[0]/contentStream[0](3194 0 obj PDSemanticContentStream)/content[0]/contentItem[1]], locationContext=null, errorMessage=null], 
TestAssertion [ruleId=RuleId [specification=ISO 14289-1:2014, clause=7.1, testNumber=3], status=failed,
message=Content shall be marked as Artifact or tagged as real content,
location=Location [level=CosDocument, context=root/document[0]/pages[10](19 0 obj PDPage)/annots[20](154 0 obj PDMarkupAnnot)/appearance[0]/contentStream[0](3028 0 obj PDContentStream)/operators[2]/xObject[0]/contentStream[0](3133 0 obj PDSemanticContentStream)/operators[0]/xObject[0]/contentStream[0](3194 0 obj PDSemanticContentStream)/content[0]/contentItem[2]], locationContext=null, errorMessage=null], 
TestAssertion [ruleId=RuleId [specification=ISO 14289-1:2014, clause=7.1, testNumber=3], status=failed,
message=Content shall be marked as Artifact or tagged as real content,
location=Location [level=CosDocument, context=root/document[0]/pages[10](19 0 obj PDPage)/annots[20](154 0 obj PDMarkupAnnot)/appearance[0]/contentStream[0](3028 0 obj PDContentStream)/operators[2]/xObject[0]/contentStream[0](3133 0 obj PDSemanticContentStream)/operators[0]/xObject[0]/contentStream[0](3194 0 obj PDSemanticContentStream)/content[0]/contentItem[3]], locationContext=null, errorMessage=null], 
TestAssertion [ruleId=RuleId [specification=ISO 14289-1:2014, clause=7.1, testNumber=3], status=failed,
message=Content shall be marked as Artifact or tagged as real content,
location=Location [level=CosDocument, context=root/document[0]/pages[10](19 0 obj PDPage)/annots[20](154 0 obj PDMarkupAnnot)/appearance[0]/contentStream[0](3028 0 obj PDContentStream)/operators[2]/xObject[0]/contentStream[0](3133 0 obj PDSemanticContentStream)/operators[0]/xObject[0]/contentStream[0](3194 0 obj PDSemanticContentStream)/content[0]/contentItem[4]], locationContext=null, errorMessage=null], 
TestAssertion [ruleId=RuleId [specification=ISO 14289-1:2014, clause=7.1, testNumber=3], status=failed,
message=Content shall be marked as Artifact or tagged as real content,
location=Location [level=CosDocument, context=root/document[0]/pages[10](19 0 obj PDPage)/annots[20](154 0 obj PDMarkupAnnot)/appearance[0]/contentStream[0](3028 0 obj PDContentStream)/operators[2]/xObject[0]/contentStream[0](3133 0 obj PDSemanticContentStream)/operators[0]/xObject[0]/contentStream[0](3194 0 obj PDSemanticContentStream)/content[0]/contentItem[5]], locationContext=null, errorMessage=null], 
TestAssertion [ruleId=RuleId [specification=ISO 14289-1:2014, clause=7.1, testNumber=3], status=failed,
message=Content shall be marked as Artifact or tagged as real content,
location=Location [level=CosDocument, context=root/document[0]/pages[10](19 0 obj PDPage)/annots[20](154 0 obj PDMarkupAnnot)/appearance[0]/contentStream[0](3028 0 obj PDContentStream)/operators[2]/xObject[0]/contentStream[0](3133 0 obj PDSemanticContentStream)/operators[0]/xObject[0]/contentStream[0](3194 0 obj PDSemanticContentStream)/content[0]/contentItem[6]], locationContext=null, errorMessage=null], 
TestAssertion [ruleId=RuleId [specification=ISO 14289-1:2014, clause=7.1, testNumber=3], status=failed,
message=Content shall be marked as Artifact or tagged as real content,
location=Location [level=CosDocument, context=root/document[0]/pages[10](19 0 obj PDPage)/annots[20](154 0 obj PDMarkupAnnot)/appearance[0]/contentStream[0](3028 0 obj PDContentStream)/operators[2]/xObject[0]/contentStream[0](3133 0 obj PDSemanticContentStream)/operators[0]/xObject[0]/contentStream[0](3194 0 obj PDSemanticContentStream)/content[0]/contentItem[7]], locationContext=null, errorMessage=null], 
TestAssertion [ruleId=RuleId [specification=ISO 14289-1:2014, clause=7.1, testNumber=3], status=failed,
message=Content shall be marked as Artifact or tagged as real content,
location=Location [level=CosDocument, context=root/document[0]/pages[10](19 0 obj PDPage)/annots[20](154 0 obj PDMarkupAnnot)/appearance[0]/contentStream[0](3028 0 obj PDContentStream)/operators[2]/xObject[0]/contentStream[0](3133 0 obj PDSemanticContentStream)/operators[0]/xObject[0]/contentStream[0](3194 0 obj PDSemanticContentStream)/content[0]/contentItem[8]], locationContext=null, errorMessage=null], 
TestAssertion [ruleId=RuleId [specification=ISO 14289-1:2014, clause=7.1, testNumber=3], status=failed,
message=Content shall be marked as Artifact or tagged as real content,
location=Location [level=CosDocument, context=root/document[0]/pages[10](19 0 obj PDPage)/annots[20](154 0 obj PDMarkupAnnot)/appearance[0]/contentStream[0](3028 0 obj PDContentStream)/operators[2]/xObject[0]/contentStream[0](3133 0 obj PDSemanticContentStream)/operators[0]/xObject[0]/contentStream[0](3194 0 obj PDSemanticContentStream)/content[0]/contentItem[9]], locationContext=null, errorMessage=null], 
TestAssertion [ruleId=RuleId [specification=ISO 14289-1:2014, clause=7.1, testNumber=3], status=failed,
message=Content shall be marked as Artifact or tagged as real content,
location=Location [level=CosDocument, context=root/document[0]/pages[10](19 0 obj PDPage)/annots[20](154 0 obj PDMarkupAnnot)/appearance[0]/contentStream[0](3028 0 obj PDContentStream)/operators[2]/xObject[0]/contentStream[0](3133 0 obj PDSemanticContentStream)/operators[0]/xObject[0]/contentStream[0](3194 0 obj PDSemanticContentStream)/content[0]/contentItem[10]], locationContext=null, errorMessage=null], 
TestAssertion [ruleId=RuleId [specification=ISO 14289-1:2014, clause=7.1, testNumber=3], status=failed,
message=Content shall be marked as Artifact or tagged as real content,
location=Location [level=CosDocument, context=root/document[0]/pages[10](19 0 obj PDPage)/annots[20](154 0 obj PDMarkupAnnot)/appearance[0]/contentStream[0](3028 0 obj PDContentStream)/operators[2]/xObject[0]/contentStream[0](3133 0 obj PDSemanticContentStream)/operators[0]/xObject[0]/contentStream[0](3194 0 obj PDSemanticContentStream)/content[0]/contentItem[11]], locationContext=null, errorMessage=null]], isCompliant=false]

From PDF:

154 0 obj
<<
/Type /Annot
/Page 10
/C [1.0 0.7647059 0.2]
/M (D:20240425000000)
/F 4
/NM ()
/Rect [65.6075 622.4095 510.23352 758.371]
/T (ISO)
/CA 0.3
/Subj (Highlight)
/IT /
/Contents ()
/BS 1192 0 R
/QuadPoints [89.899994 745.371 145.63101 745.371 89.899994 732.71295 145.63101 732.71295 70.866 722.194
300.40298 722.194 70.866 710.868 300.40298 710.868 319.026 722.194 349.441 722.194
319.026 710.868 349.441 710.868 349.441 722.194 352.334 722.194 349.441 710.868
352.334 710.868 352.33398 722.194 420.52304 722.194 352.33398 710.868 420.52304 710.868
420.523 722.194 422.778 722.194 420.523 710.868 422.778 710.868 70.866 690.571
78.562 690.571 70.866 677.91296 78.562 677.91296 89.899994 690.571 169.59001 690.571
89.899994 677.91296 169.59001 677.91296 70.866 661.18195 87.84599 661.18195 70.866 649.18994
87.84599 649.18994 96.349 661.18195 190.30899 661.18195 96.349 649.18994 190.30899 649.18994
70.866 638.99396 465.348 638.99396 70.866 627.66797 465.348 627.66797 502.22 638.99396
504.475 638.99396 502.22 627.66797 504.475 627.66797]
/Subtype /Highlight
/AP 1193 0 R
>>
endobj

I'll try to fix it also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 🏗 In progress
Development

No branches or pull requests

2 participants