Skip to content

Commit

Permalink
Add PDF/UA-2 rules
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximPlusov authored and bdoubrov committed Nov 29, 2023
1 parent 2a2898d commit a483cdc
Show file tree
Hide file tree
Showing 88 changed files with 3,328 additions and 0 deletions.
21 changes: 21 additions & 0 deletions PDF_UA/2/5 Version identification/verapdf-profile-5-t01.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<profile xmlns="http://www.verapdf.org/ValidationProfile" flavour="PDFUA_2">
<details creator="veraPDF Consortium" created="2023-03-13T10:53:06.894+03:00">
<name>ISO 14289-2:202x - 5 Version identification - PDF/UA Identification Schema</name>
<description>The PDF/UA version of a file shall be specified in the value of the Metadata entry in the document catalog using the PDF/UA identification schema</description>
</details>
<hash></hash>
<rules>
<rule object="MainXMPPackage">
<id specification="ISO_14289_2" clause="5" testNumber="1"/>
<description>The PDF/UA version of a file shall be specified in the value of the Metadata entry in the document catalog using the PDF/UA identification schema</description>
<test>UAIdentification_size == 1</test>
<error>
<message>The document metadata stream doesn't contains PDF/UA Identification Schema</message>
<arguments/>
</error>
<references/>
</rule>
</rules>
<variables/>
</profile>
26 changes: 26 additions & 0 deletions PDF_UA/2/5 Version identification/verapdf-profile-5-t02.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<profile xmlns="http://www.verapdf.org/ValidationProfile" flavour="PDFUA_2">
<details creator="veraPDF Consortium" created="2023-03-13T10:53:07.114+03:00">
<name>ISO 14289-2:202x - 5 Version identification - Part number</name>
<description>The value of pdfuaid:part shall be the part number of the International Standard to which the file
conforms</description>
</details>
<hash></hash>
<rules>
<rule object="PDFUAIdentification">
<id specification="ISO_14289_2" clause="5" testNumber="2"/>
<description>The value of pdfuaid:part shall be the part number of the International Standard to which the
file conforms</description>
<test>part == 2</test>
<error>
<message>The &quot;part&quot; property of the PDF/UA Identification Schema is %1 instead of 2 for
PDF/UA-2 conforming file</message>
<arguments>
<argument>part</argument>
</arguments>
</error>
<references/>
</rule>
</rules>
<variables/>
</profile>
23 changes: 23 additions & 0 deletions PDF_UA/2/5 Version identification/verapdf-profile-5-t03.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<profile xmlns="http://www.verapdf.org/ValidationProfile" flavour="PDFUA_2">
<details creator="veraPDF Consortium" created="2023-03-13T10:53:07.114+03:00">
<name>ISO 14289-2:202x - 5 Version identification - part prefix</name>
<description>Property part of the PDF/UA Identification Schema shall have namespace prefix pdfuaid</description>
</details>
<hash></hash>
<rules>
<rule object="PDFUAIdentification">
<id specification="ISO_14289_2" clause="5" testNumber="3"/>
<description>Property part of the PDF/UA Identification Schema shall have namespace prefix pdfuaid</description>
<test>partPrefix == null || partPrefix == &quot;pdfuaid&quot;</test>
<error>
<message>Property part of the PDF/UA Identification Schema has invalid namespace prefix %1</message>
<arguments>
<argument>partPrefix</argument>
</arguments>
</error>
<references/>
</rule>
</rules>
<variables/>
</profile>
23 changes: 23 additions & 0 deletions PDF_UA/2/5 Version identification/verapdf-profile-5-t04.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<profile xmlns="http://www.verapdf.org/ValidationProfile" flavour="PDFUA_2">
<details creator="veraPDF Consortium" created="2023-03-13T10:53:07.114+03:00">
<name>ISO 14289-2:202x - 5 Version identification - rev prefix</name>
<description>Property rev of the PDF/UA Identification Schema shall have namespace prefix pdfuaid</description>
</details>
<hash></hash>
<rules>
<rule object="PDFUAIdentification">
<id specification="ISO_14289_2" clause="5" testNumber="4"/>
<description>Property rev of the PDF/UA Identification Schema shall have namespace prefix pdfuaid</description>
<test>revPrefix == null || revPrefix == &quot;pdfuaid&quot;</test>
<error>
<message>Property rev of the PDF/UA Identification Schema has invalid namespace prefix %1</message>
<arguments>
<argument>revPrefix</argument>
</arguments>
</error>
<references/>
</rule>
</rules>
<variables/>
</profile>
23 changes: 23 additions & 0 deletions PDF_UA/2/5 Version identification/verapdf-profile-5-t05.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<profile xmlns="http://www.verapdf.org/ValidationProfile" flavour="PDFUA_2">
<details creator="veraPDF Consortium" created="2023-03-13T10:53:07.114+03:00">
<name>ISO 14289-2:202x - 5 Version identification - rev property</name>
<description>The value of pdfuaid:rev shall be the four digit year</description>
</details>
<hash></hash>
<rules>
<rule object="PDFUAIdentification">
<id specification="ISO_14289_2" clause="5" testNumber="5"/>
<description>The value of pdfuaid:rev shall be the four digit year</description>
<test>/^\d{4}$/.test(rev)</test>
<error>
<message>The value of pdfuaid:rev (%1) not the four digit year</message>
<arguments>
<argument>rev</argument>
</arguments>
</error>
<references/>
</rule>
</rules>
<variables/>
</profile>
26 changes: 26 additions & 0 deletions PDF_UA/2/8.10 Forms/8.10.1 General/verapdf-profile-8-10-1-t01.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<profile xmlns="http://www.verapdf.org/ValidationProfile" flavour="PDFUA_2">
<details creator="veraPDF Consortium" created="2023-03-13T10:53:06.894+03:00">
<name>ISO 14289-2:202x - 8.10 Forms - 8.10.1 General - Form structure element</name>
<description>Each widget annotation shall be enclosed by a Form structure element unless the widget annotation
is an artifact</description>
</details>
<hash></hash>
<rules>
<rule object="PDWidgetAnnot">
<id specification="ISO_14289_2" clause="8.10.1" testNumber="1"/>
<description>Each widget annotation shall be enclosed by a Form structure element unless the widget
annotation is an artifact</description>
<test>structParentType == null || structParentStandardType == 'Form' || isArtifact == true</test>
<error>
<message>A Widget annotation is nested within %1 tag (standard type = %2) instead of Form or Artifact</message>
<arguments>
<argument>structParentType</argument>
<argument>structParentStandardType</argument>
</arguments>
</error>
<references/>
</rule>
</rules>
<variables/>
</profile>
23 changes: 23 additions & 0 deletions PDF_UA/2/8.10 Forms/8.10.1 General/verapdf-profile-8-10-1-t02.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<profile xmlns="http://www.verapdf.org/ValidationProfile" flavour="PDFUA_2">
<details creator="veraPDF Consortium" created="2023-03-13T10:53:06.894+03:00">
<name>ISO 14289-2:202x - 8.10 Forms - 8.10.1 General - Widget annotations count</name>
<description>A Form structure element shall contain at most one widget annotation</description>
</details>
<hash></hash>
<rules>
<rule object="SEForm">
<id specification="ISO_14289_2" clause="8.10.1" testNumber="2"/>
<description>A Form structure element shall contain at most one widget annotation</description>
<test>widgetAnnotsCount &lt;= 1</test>
<error>
<message>A Form structure element contains %1 annotations</message>
<arguments>
<argument>widgetAnnotsCount</argument>
</arguments>
</error>
<references/>
</rule>
</rules>
<variables/>
</profile>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<profile xmlns="http://www.verapdf.org/ValidationProfile" flavour="PDFUA_2">
<details creator="veraPDF Consortium" created="2023-03-13T10:53:06.894+03:00">
<name>ISO 14289-2:202x - 8.10 Forms - 8.10.2.3 Contents entry - Lbl</name>
<description>If a label for a widget annotation is not present, a Contents entry shall be provided to supply
description and context for the widget</description>
</details>
<hash></hash>
<rules>
<rule object="PDWidgetAnnot">
<id specification="ISO_14289_2" clause="8.10.2.3" testNumber="1"/>
<description>If a label for a widget annotation is not present, a Contents entry shall be provided to supply
description and context for the widget</description>
<test>containsLbl == true || Contents != null</test>
<error>
<message>Widget annotation contains neither label nor Contents entry</message>
<arguments/>
</error>
<references/>
</rule>
</rules>
<variables/>
</profile>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<profile xmlns="http://www.verapdf.org/ValidationProfile" flavour="PDFUA_2">
<details creator="veraPDF Consortium" created="2023-03-13T10:53:06.894+03:00">
<name>ISO 14289-2:202x - 8.10 Forms - 8.10.3.3 Text fields - RV and V entries</name>
<description>For text fields, when an RV entry is present a V entry shall also be present, and they shall be
textually equivalent</description>
</details>
<hash></hash>
<rules>
<rule object="PDTextField">
<id specification="ISO_14289_2" clause="8.10.3.3" testNumber="1"/>
<description>For text fields, when an RV entry is present a V entry shall also be present, and they shall be
textually equivalent</description>
<test>containsRV == false || (V != null &amp;&amp; RV == V)</test>
<error>
<message>Text field contains RV entry, but no V entry or they are not textually equivalent (RV = %1, V = %2)</message>
<arguments>
<argument>RV</argument>
<argument>V</argument>
</arguments>
</error>
<references/>
</rule>
</rules>
<variables/>
</profile>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<profile xmlns="http://www.verapdf.org/ValidationProfile" flavour="PDFUA_2">
<details creator="veraPDF Consortium" created="2023-03-13T10:53:06.894+03:00">
<name>ISO 14289-2:202x - 8.10 Forms - 8.10.3.5 Signature fields - Alt for the graphic</name>
<description>If a portion of the appearance of a signature is represented by a graphic, alternative text shall
be provided for that graphic</description>
</details>
<hash></hash>
<rules>
<rule object="SELineArtItem">
<id specification="ISO_14289_2" clause="8.10.3.5" testNumber="1"/>
<description>If a portion of the appearance of a signature is represented by a graphic, alternative text
shall be provided for that graphic</description>
<test>isSignature == false || Alt != null</test>
<error>
<message>A portion of the appearance of a signature is represented by a graphic, but alternative text
is not provided for that graphic</message>
<arguments/>
</error>
<references/>
</rule>
</rules>
<variables/>
</profile>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<profile xmlns="http://www.verapdf.org/ValidationProfile" flavour="PDFUA_2">
<details creator="veraPDF Consortium" created="2023-03-13T10:53:06.894+03:00">
<name>ISO 14289-2:202x - 8.11 Metadata - 8.11.1 General - Dc title</name>
<description>The Metadata stream as specified in ISO 32000-2:2020, 14.3 in the document catalog dictionary shall
contain a dc:title entry</description>
</details>
<hash></hash>
<rules>
<rule object="MainXMPPackage">
<id specification="ISO_14289_2" clause="8.11.1" testNumber="1"/>
<description>The Metadata stream as specified in ISO 32000-2:2020, 14.3 in the document catalog dictionary
shall contain a dc:title entry</description>
<test>dc_title != null</test>
<error>
<message>Metadata stream does not contain dc:title</message>
<arguments/>
</error>
<references>
<reference specification="ISO 32000-2:2020" clause="14.3"/>
</references>
</rule>
</rules>
<variables/>
</profile>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<profile xmlns="http://www.verapdf.org/ValidationProfile" flavour="PDFUA_2">
<details creator="veraPDF Consortium" created="2023-03-13T10:58:04.098+03:00">
<name>ISO 14289-2:202x - 8.11 Metadata - 8.11.2 Interactive aspects - DisplayDocTitle</name>
<description>The ViewerPreferences dictionary of the document catalog dictionary shall be present and shall
contain at least the DisplayDocTitle key with a value of true, as described in ISO 32000-2:2020, Table 147</description>
</details>
<hash></hash>
<rules>
<rule object="CosDocument">
<id specification="ISO_14289_2" clause="8.11.2" testNumber="1"/>
<description>The ViewerPreferences dictionary of the document catalog dictionary shall be present and shall
contain at least the DisplayDocTitle key with a value of true, as described in ISO 32000-2:2020, Table 147</description>
<test>DisplayDocTitle == true</test>
<error>
<message>ViewerPreferences dictionary is not present in the document Catalog, or DisplayDocTitle key is
set to false or is not present in the ViewerPreferences dictionary (ViewerPreferences = %1,
DisplayDocTitle = %2)</message>
<arguments>
<argument>ViewerPreferences</argument>
<argument>DisplayDocTitle</argument>
</arguments>
</error>
<references>
<reference specification="ISO 32000-2:2020" clause="12.2, Table 147"/>
</references>
</rule>
</rules>
<variables/>
</profile>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<profile xmlns="http://www.verapdf.org/ValidationProfile" flavour="PDFUA_2">
<details creator="veraPDF Consortium" created="2023-03-13T10:58:08.812+03:00">
<name>ISO 14289-2:202x - 8.14 Use of embedded files - 8.14.1 Descriptions for embedded files - Desc entry</name>
<description>The Desc entry shall be present on all file specification dictionaries present in the EmbeddedFiles
name tree of a conforming document</description>
</details>
<hash></hash>
<rules>
<rule object="CosFileSpecification">
<id specification="ISO_14289_2" clause="8.14.1" testNumber="1"/>
<description>The Desc entry shall be present on all file specification dictionaries present in the
EmbeddedFiles name tree of a conforming document</description>
<test>containsDesc == true</test>
<error>
<message>The file specification dictionary for an embedded file does not contain Desc key</message>
<arguments/>
</error>
<references/>
</rule>
</rules>
<variables/>
</profile>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<profile xmlns="http://www.verapdf.org/ValidationProfile" flavour="PDFUA_2">
<details creator="veraPDF Consortium" created="2023-03-13T10:58:04.098+03:00">
<name>ISO 14289-2:202x - 8.2 Logical structure - 8.2.1 General - StructureTreeRoot</name>
<description>The logical structure of the conforming file shall be described by a structure hierarchy rooted
in the StructTreeRoot entry of the document catalog dictionary, as described in ISO 32000-2:2020, 14.7</description>
</details>
<hash></hash>
<rules>
<rule object="PDDocument">
<id specification="ISO_14289_2" clause="8.2.1" testNumber="1"/>
<description>The logical structure of the conforming file shall be described by a structure hierarchy rooted
in the StructTreeRoot entry of the document catalog dictionary, as described in ISO 32000-2:2020, 14.7</description>
<test>StructTreeRoot_size == 1</test>
<error>
<message>StructTreeRoot entry is not present in the document catalog</message>
<arguments/>
</error>
<references>
<reference specification="ISO 32000-2:2020" clause="14.7"/>
</references>
</rule>
</rules>
<variables/>
</profile>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<profile xmlns="http://www.verapdf.org/ValidationProfile" flavour="PDFUA_2">
<details creator="veraPDF Consortium" created="2023-03-13T10:58:04.098+03:00">
<name>ISO 14289-2:202x - 8.2 Logical structure - 8.2.2 Real content - Artifact or real content</name>
<description>Content that is not considered real shall be an artifact</description>
</details>
<hash></hash>
<rules>
<rule object="SESimpleContentItem">
<id specification="ISO_14289_2" clause="8.2.2" testNumber="1"/>
<description>Content that is not considered real shall be an artifact</description>
<test>parentStructureTag != null || parentsTags.split('&amp;').filter(elem =&gt; elem == 'Artifact').length &gt; 0</test>
<error>
<message>Content is neither marked as Artifact nor tagged as real content</message>
<arguments/>
</error>
<references/>
</rule>
</rules>
<variables/>
</profile>
Loading

0 comments on commit a483cdc

Please sign in to comment.