Skip to content

Commit a137a16

Browse files
MaximPlusovbundolee
authored andcommitted
Auto-tagging. Remove Encrypt entry
1 parent 756a90a commit a137a16

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

java/opendataloader-pdf-core/src/main/java/org/opendataloader/pdf/processors/AutoTaggingProcessor.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public static synchronized void createTaggedPDF(File inputPDF, String outputFold
5858
updatePages(document, cosDocument);
5959
createLinkAnnotationStructElements(document, cosDocument, seDocument);
6060
createParentTree(cosDocument, structTreeRoot);
61+
cosDocument.getTrailer().removeKey(ASAtom.ENCRYPT);
6162
String outputFileName = outputFolder + File.separator +
6263
inputPDF.getName().substring(0, inputPDF.getName().length() - 4) + "_tagged.pdf";
6364
document.saveAs(outputFileName);
@@ -87,7 +88,6 @@ private static void updatePages(PDDocument document, COSDocument cosDocument) th
8788
cosDocument.addChangedObject(contentsObject);
8889
} else {
8990
page.getObject().setKey(ASAtom.CONTENTS, createContentsIndirect(cosDocument, processedTokens));
90-
cosDocument.addChangedObject(page.getObject());
9191
}
9292
} else {
9393
COSObject streamsArray = COSArray.construct();
@@ -98,7 +98,6 @@ private static void updatePages(PDDocument document, COSDocument cosDocument) th
9898
streamsArray.add(streamIndirect);
9999
}
100100
page.getObject().setKey(ASAtom.CONTENTS, streamsArray);
101-
cosDocument.addChangedObject(page.getObject());
102101
}
103102
}
104103
}

0 commit comments

Comments
 (0)