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

REL 1.26 - Merge release to master branch #347

Merged
merged 55 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
9d40097
DEV: v1.25
MaximPlusov Jun 23, 2023
72da19a
Merge pull request #314 from veraPDF/update_dev
MaximPlusov Jun 23, 2023
95b406a
PDF/A validation. Add getBitsPerComponent
MaximPlusov Jul 11, 2023
7bf323f
Merge pull request #316 from veraPDF/bits_per_component
MaximPlusov Jul 11, 2023
7d96230
FIX: Missing resource for component release details
carlwilson Jul 13, 2023
aeaa622
Merge pull request #317 from veraPDF/fix/missing-parser-details
carlwilson Jul 14, 2023
5105b98
Fix metadata. Add method getAuthorSize
MaximPlusov Jul 19, 2023
beac7c0
Merge pull request #318 from veraPDF/author_size
MaximPlusov Jul 19, 2023
47d9a0d
Add getstructParentStandardType to PBoxPDAnnot
MaximPlusov Sep 13, 2023
7fddf61
Merge pull request #319 from veraPDF/annot_structure_parent
MaximPlusov Sep 14, 2023
b057b0c
Update metadata fixer method names
MaximPlusov Sep 14, 2023
3d32332
Merge pull request #320 from veraPDF/metadata_methods
MaximPlusov Sep 14, 2023
a479234
PDF/UA-2. Add new methods
MaximPlusov Sep 18, 2023
fb3a1de
Merge pull request #321 from veraPDF/pdfua2
MaximPlusov Sep 22, 2023
e02bb8d
PDF/UA-2. Add getcontainsConfigs to PBoxPDOCProperties
MaximPlusov Sep 27, 2023
eb22fa0
PDF/UA-2. Add new methods
MaximPlusov Oct 10, 2023
05cee78
Merge pull request #322 from veraPDF/pdfua2_methods
MaximPlusov Oct 10, 2023
c3c2326
Change appearance link from PDContentStream to PDXForm in PDAnnot
MaximPlusov Oct 17, 2023
2db0ba1
PDF/UA-2. Add new methods.
MaximPlusov Oct 18, 2023
e17bd42
Merge pull request #323 from veraPDF/pdfua2_methods
MaximPlusov Oct 19, 2023
1f92ead
Merge pull request #324 from veraPDF/pdfua2
MaximPlusov Oct 19, 2023
0925598
PDF/UA-2. Add new methods.
MaximPlusov Oct 20, 2023
8f77b35
Merge pull request #325 from veraPDF/pdfua2
MaximPlusov Oct 20, 2023
b5b7df3
PDF/UA-2. Add getaltPresent to PBGlyph.
MaximPlusov Oct 21, 2023
a076105
Merge pull request #326 from veraPDF/pdfua2
MaximPlusov Oct 23, 2023
a3c30dc
Merge pull request #327 from veraPDF/appearance_xform
MaximPlusov Oct 23, 2023
3549396
PDF/UA-2. Add new annotations methods
MaximPlusov Oct 31, 2023
eadc4fe
Merge pull request #329 from veraPDF/pdfua2_annotation
MaximPlusov Oct 31, 2023
0be5fce
PDF/UA-2. Add getisArtifact to PBoxPDAnnot
MaximPlusov Oct 26, 2023
10ab101
Merge pull request #328 from veraPDF/pdfua2
MaximPlusov Oct 31, 2023
b0a55e4
PDF/UA-2. Add new methods
MaximPlusov Nov 6, 2023
511ab37
Merge pull request #330 from veraPDF/pdfua2
MaximPlusov Nov 6, 2023
16834ec
Fix NullPointerException in getParentLang in PBoxPDStructElem
MaximPlusov Nov 9, 2023
44ca681
Merge pull request #331 from veraPDF/null_pointer
MaximPlusov Nov 9, 2023
ced2453
Fix getcontainsXRefStream in PBoxPDDocument
MaximPlusov Nov 13, 2023
23f8326
Merge pull request #332 from veraPDF/xref_stream
MaximPlusov Nov 13, 2023
ba0fc79
Add StaticXmpCoreContainers to cleanUp
MaximPlusov Dec 7, 2023
4b4a6ef
Merge pull request #333 from veraPDF/static_xmp_containers
MaximPlusov Dec 11, 2023
3a0295b
Add getcontainsParent to PBoxPDStructElem
MaximPlusov Dec 13, 2023
7bce3c8
Merge pull request #334 from veraPDF/struct_elem_parent
MaximPlusov Dec 14, 2023
ea430e4
Add getpresentInEmbeddedFiles to PBCosFileSpecification
MaximPlusov Dec 18, 2023
65dd7c6
Merge pull request #335 from veraPDF/embedded_file_specification
MaximPlusov Dec 20, 2023
f1d84ca
Add getremappedStandardType to PBoxPDStructElem
MaximPlusov Dec 20, 2023
41dc152
Merge pull request #336 from veraPDF/remapped_standard_type
MaximPlusov Dec 27, 2023
12f87e1
Remove unnecessary methods
MaximPlusov Feb 1, 2024
c1f34f5
Merge pull request #337 from veraPDF/remove_methods
MaximPlusov Feb 2, 2024
b208db4
RC - v1.26
MaximPlusov Feb 9, 2024
926e15d
Merge pull request #338 from veraPDF/prerelease1.26
MaximPlusov Feb 9, 2024
acd263d
Workflow update (#339)
ProxyNexus Feb 21, 2024
b1c88bc
PDF/UA-2. Add methods
MaximPlusov Feb 22, 2024
ae0bcf4
Fix NullPointerException
MaximPlusov Feb 23, 2024
a7fa269
PDF/UA-2. Add getisRealContent to PBGlyph
MaximPlusov Mar 25, 2024
529d38b
Add Kids to PBoxPDFormField
MaximPlusov Apr 8, 2024
5eafaa4
REL - v1.26
MaximPlusov May 16, 2024
a338be6
Merge branch 'master' into rel/1.26
MaximPlusov May 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,19 @@ on:
jobs:
build:
name: Checkout and Build
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

continue-on-error: true

strategy:
fail-fast: false
matrix:
java-version: [8, 11, 16, 17]
java-version: [8, 11, 16, 17, 21]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: JDK setup
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java-version }}
distribution: 'temurin'
Expand Down Expand Up @@ -44,11 +47,11 @@ jobs:

coverage:
name: Quality Assurance
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
needs: [ build ]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Download metadata coverage report
uses: actions/download-artifact@master
with:
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/update-jakarta-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,21 @@ jobs:
checkout-and-build:
runs-on: ubuntu-latest

continue-on-error: true

strategy:
fail-fast: false
matrix:
java-version: [11, 16, 17]
java-version: [11, 16, 17, 21]

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: integration
- name: JDK setup
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java-version }}
distribution: 'temurin'
Expand All @@ -44,7 +47,7 @@ jobs:
needs: checkout-and-build
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: integration
Expand Down
13 changes: 0 additions & 13 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ veraPDF-pdfbox-validation
=========================
*PDF Box based PDF/A and PDF/UA validation, feature extraction and metadata repair developed for veraPDF*

[![Build Status](https://jenkins.openpreservation.org/job/veraPDF/job/1.24/job/pdfbox-validation/badge/icon)](https://jenkins.openpreservation.org/job/veraPDF/job/1.24/job/pdfbox-validation/ "OPF Jenkins")
[![Build Status](https://jenkins.openpreservation.org/job/veraPDF/job/1.26/job/pdfbox-validation/badge/icon)](https://jenkins.openpreservation.org/job/veraPDF/job/1.26/job/pdfbox-validation/ "OPF Jenkins")
[![Maven Central](https://img.shields.io/maven-central/v/org.verapdf/pdfbox-validation-model.svg)](https://repo1.maven.org/maven2/org/verapdf/pdfbox-validation-model/ "Maven central")
[![CodeCov Coverage](https://img.shields.io/codecov/c/github/veraPDF/veraPDF-pdfbox-validation.svg)](https://codecov.io/gh/veraPDF/veraPDF-pdfbox-validation/ "CodeCov coverage")
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/216fae32f94541e694228d96527aee5c)](https://app.codacy.com/gh/veraPDF/veraPDF-pdfbox-validation/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade "Codacy coverage")
Expand All @@ -29,7 +29,7 @@ Quick Start

In order to build the parser you'll need:

* Java 9 - 17, which can be downloaded [from Oracle](https://www.oracle.com/technetwork/java/javase/downloads/index.html), or for Linux users [OpenJDK](https://openjdk.java.net/install/index.html).
* Java 9 - 21, which can be downloaded [from Oracle](https://www.oracle.com/technetwork/java/javase/downloads/index.html), or for Linux users [OpenJDK](https://openjdk.java.net/install/index.html).
* [Maven v3+](https://maven.apache.org/)

### Building the veraPDF PDF Box Validation Model
Expand Down
2 changes: 1 addition & 1 deletion pdfbox-feature-reporting/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<parent>
<artifactId>verapdf-pdfbox-validation</artifactId>
<groupId>org.verapdf</groupId>
<version>1.24.0</version>
<version>1.26.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion pdfbox-metadata-fixer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<parent>
<artifactId>verapdf-pdfbox-validation</artifactId>
<groupId>org.verapdf</groupId>
<version>1.24.0</version>
<version>1.26.0</version>
</parent>

<artifactId>pdfbox-metadata-fixer</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ public String getAuthor() {
return this.info.getAuthor();
}

@Override
public int getAuthorSize() {
return this.info.getAuthor() != null ? 1 : 0;
}

@Override
public void setAuthor(String author) {
this.info.setAuthor(author);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,15 @@ public void removePDFIdentificationSchema(
try {
if (isValidIdentification()) {
int part = flavour.getPart().getPartNumber();
Integer schemaPart = this.metadata.getIdentificationPart();
Integer schemaPart = this.metadata.getPDFAIdentificationPart();

if (schemaPart != null &&
schemaPart.intValue() != part) {
return;
}
}

boolean isDeleted = this.metadata.deleteIdentificationSchema();
boolean isDeleted = this.metadata.deletePDFAIdentificationSchema();
if (isDeleted) {
this.setNeedToBeUpdated(true);
resultBuilder.addFix("Identification schema removed");
Expand All @@ -141,8 +141,8 @@ public void addPDFIdentificationSchema(

try {
if (isValidIdentification()) {
Integer schemaPart = this.metadata.getIdentificationPart();
String schemaConformance = this.metadata.getIdentificationConformance();
Integer schemaPart = this.metadata.getPDFAIdentificationPart();
String schemaConformance = this.metadata.getPDFAIdentificationConformance();

if (schemaPart != null &&
schemaConformance != null &&
Expand All @@ -152,8 +152,8 @@ public void addPDFIdentificationSchema(
}
}

this.metadata.setIdentificationPart(Integer.valueOf(part));
this.metadata.setIdentificationConformance(conformance);
this.metadata.setPDFAIdentificationPart(Integer.valueOf(part));
this.metadata.setPDFAIdentificationConformance(conformance);
this.setNeedToBeUpdated(true);
resultBuilder.addFix("Identification schema added");

Expand Down Expand Up @@ -184,16 +184,15 @@ private static int confToInt(String conf) {

private boolean isValidIdentification() {
try {
Integer identificationPart = this.metadata.getIdentificationPart();
Integer identificationPart = this.metadata.getPDFAIdentificationPart();
if (identificationPart == null) {
return false;
}
String identificationConformance = this.metadata.getIdentificationConformance();
String identificationConformance = this.metadata.getPDFAIdentificationConformance();
if (identificationPart.intValue() == 1) {
return "A".equals(identificationConformance) || "B".equals(identificationConformance);
} else if (identificationPart.intValue() == 2 || identificationPart.intValue() == 3) {
return "A".equals(this.metadata.getIdentificationConformance()) ||
"U".equals(identificationConformance) ||
return "A".equals(identificationConformance) || "U".equals(identificationConformance) ||
"B".equals(identificationConformance);
} else {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,18 @@ public String getAuthor() {
}
}

@Override
public int getAuthorSize() {
try {
List<String> creators = this.meta.getCreator();
if (creators != null) {
return creators.size();
}
} catch (XMPException ignored) {
}
return 0;
}

@Override
public void setAuthor(String creator) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ public void addPDFIdentificationSchemaTest() throws IOException, XMPException {
MetadataFixerResultImpl.Builder builder = new MetadataFixerResultImpl.Builder();
impl.addPDFIdentificationSchema(builder, PDFAFlavour.PDFA_1_B);

assertEquals(filePart, xmp.getIdentificationPart());
assertEquals(fileConformance, xmp.getIdentificationConformance());
assertEquals(filePart, xmp.getPDFAIdentificationPart());
assertEquals(fileConformance, xmp.getPDFAIdentificationConformance());
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion pdfbox-validation-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<parent>
<artifactId>verapdf-pdfbox-validation</artifactId>
<groupId>org.verapdf</groupId>
<version>1.24.0</version>
<version>1.26.0</version>
</parent>

<artifactId>pdfbox-validation-model</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
package org.verapdf.model;

import org.verapdf.xmp.XMPException;
import org.verapdf.xmp.containers.StaticXmpCoreContainers;
import org.verapdf.xmp.impl.VeraPDFMeta;
import java.util.logging.Logger;
import org.apache.pdfbox.pdmodel.PDDocument;
Expand Down Expand Up @@ -56,7 +57,7 @@
*/
public final class ModelParser implements PDFAParser {
private static final ReleaseDetails pdfBoxReleaseDetails = ReleaseDetails.addDetailsFromResource(
ReleaseDetails.APPLICATION_PROPERTIES_ROOT + "pdfbox-parser." + ReleaseDetails.PROPERTIES_EXT);
ReleaseDetails.APPLICATION_PROPERTIES_ROOT + "pdfbox-validation." + ReleaseDetails.PROPERTIES_EXT);
private static final URI id = URI.create("http://pdfa.verapdf.org/parser#pdfbox");
private static final ComponentDetails details = Components.veraDetails(id, "PDFBox Parser",
pdfBoxReleaseDetails.getVersion(), "veraPDF PDFBox based model parser.");
Expand Down Expand Up @@ -131,11 +132,11 @@ private static PDFAFlavour obtainFlavour(PDDocument document, PDFAFlavour defaul
}
try (InputStream is = metadata.exportXMPMetadata()) {
VeraPDFMeta veraPDFMeta = VeraPDFMeta.parse(is);
Integer identificationPart = veraPDFMeta.getIdentificationPart();
String identificationConformance = veraPDFMeta.getIdentificationConformance();
Integer identificationPart = veraPDFMeta.getPDFAIdentificationPart();
String identificationConformance = veraPDFMeta.getPDFAIdentificationConformance();
String prefix = "";
if (identificationPart == null && identificationConformance == null) {
identificationPart = veraPDFMeta.getUAIdentificationPart();
identificationPart = veraPDFMeta.getPDFUAIdentificationPart();
if (identificationPart != null) {
prefix = PDFUA_PREFIX;
}
Expand All @@ -157,6 +158,7 @@ private static PDFAFlavour obtainFlavour(PDDocument document, PDFAFlavour defaul

private static void cleanUp() {
StaticContainers.clearAllContainers();
StaticXmpCoreContainers.clearAllContainers();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
*/
package org.verapdf.model.impl.pb.cos;

import org.verapdf.model.impl.pb.operator.textshow.PUAHelper;
import org.verapdf.model.coslayer.CosActualText;
import org.apache.pdfbox.cos.COSString;

Expand All @@ -34,9 +33,4 @@ public class PBCosActualText extends PBCosString implements CosActualText {
public PBCosActualText(COSString cosString) {
super(cosString, COS_ACTUAL_TEXT_TYPE);
}

@Override
public Boolean getcontainsPUA() {
return PUAHelper.containPUA(((COSString)baseObject).getString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ public class PBCosDocument extends PBCosObject implements CosDocument {
private final boolean isOptionalContentPresent;
private final boolean isLinearised;
private final int postEOFDataSize;
private final Boolean doesInfoMatchXMP;
private final String firstPageID;
private final String lastID;
private final boolean needsRendering;
Expand Down Expand Up @@ -131,7 +130,6 @@ public PBCosDocument(COSDocument cosDocument, PDFAFlavour flavour) {
this.firstPageID = null;
}
this.isLinearised = cosDocument.getTrailer() != cosDocument.getLastTrailer() && cosDocument.isLinearized();
this.doesInfoMatchXMP = XMPChecker.doesInfoMatchXMP(cosDocument);
this.needsRendering = this.getNeedsRenderingValue();
}

Expand Down Expand Up @@ -255,14 +253,6 @@ public Boolean getisLinearized() {
return Boolean.valueOf(this.isLinearised);
}

/**
* @return true if XMP content matches Info dictionary content
*/
@Override
public Boolean getdoesInfoMatchXMP() {
return this.doesInfoMatchXMP;
}

@Override
public Boolean getMarked() {
if (this.catalog != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,22 @@ public Boolean getisAssociatedFile() {
&& StaticContainers.getFileSpecificationKeys().contains(this.baseObject.getKey()));
}

@Override
public Boolean getpresentInEmbeddedFiles() {
return null;
}

@Override
public Boolean getcontainsEF() {
return this.baseObject != null && this.baseObject instanceof COSDictionary &&
((COSDictionary) this.baseObject).containsKey(COSName.EF);
}

@Override
public Boolean getcontainsDesc() {
return null;
}

@Override
public List<? extends Object> getLinkedObjects(String link) {
if (EF.equals(link)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import org.apache.pdfbox.cos.COSString;
import org.verapdf.model.coslayer.CosString;
import org.verapdf.model.impl.pb.operator.textshow.PUAHelper;

/**
* Current class is representation of CosString interface of abstract model.
Expand Down Expand Up @@ -85,4 +86,9 @@ public Boolean getcontainsOnlyHex() {
public Long gethexCount() {
return this.hexCount;
}

@Override
public Boolean getcontainsPUA() {
return PUAHelper.containPUA(((COSString)baseObject).getString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@
import org.apache.pdfbox.cos.COSBase;
import org.apache.pdfbox.cos.COSDictionary;
import org.apache.pdfbox.cos.COSName;
import org.apache.pdfbox.cos.COSObject;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.verapdf.model.baselayer.Object;
import org.verapdf.model.coslayer.CosIndirect;
import org.verapdf.model.coslayer.CosInfo;
import org.verapdf.model.coslayer.CosTrailer;
import org.verapdf.model.impl.pb.pd.PBoxPDEncryption;
Expand Down Expand Up @@ -73,8 +71,6 @@ public Boolean getisEncrypted() {
@Override
public List<? extends Object> getLinkedObjects(String link) {
switch (link) {
case CATALOG:
return this.getCatalog();
case ENCRYPT:
return this.getEncrypt();
case INFO:
Expand All @@ -84,13 +80,6 @@ public List<? extends Object> getLinkedObjects(String link) {
}
}

private List<CosIndirect> getCatalog() {
List<CosIndirect> catalog = new ArrayList<>(MAX_NUMBER_OF_ELEMENTS);
COSBase base = ((COSDictionary) this.baseObject).getItem(COSName.ROOT);
catalog.add(new PBCosIndirect((COSObject) base, this.document, this.flavour));
return Collections.unmodifiableList(catalog);
}

private List<PDEncryption> getEncrypt() {
COSBase base = ((COSDictionary)this.baseObject).getDictionaryObject(COSName.ENCRYPT);
if (base != null && base instanceof COSDictionary) {
Expand Down
Loading
Loading