mkl-public / testarea-itext7 Goto Github PK
View Code? Open in Web Editor NEWTest area for public iText v7 issues on stackoverflow etc
Test area for public iText v7 issues on stackoverflow etc
Thank you for your contribution in stackoverflow and these demos, it helps me a lot. My english is not very good, sorry.
My question is how to remove seal When I sign many times, but i have not enough reputation to comment, so i came here...
I had read your answer and had a try, the pdf is cmp_step6_signed_by_alice_bob_carol_and_dave.pdf
public static final String DEST = "/Users/startsi/Downloads/aaaaaaaaaa.pdf";
public static final String SRC = "/Users/startsi/Downloads/cmp_step6_signed_by_alice_bob_carol_and_dave.pdf";
public static void main(String[] args) throws Exception {
new RemoveSignature().manipulatePdf3();
}
protected void manipulatePdf3() throws Exception {
PdfDocument pdfDoc = new PdfDocument(new PdfReader(SRC), new PdfWriter(DEST));
String lastName = clearLastSignature(pdfDoc);
pdfDoc.close();
}
String clearLastSignature(PdfDocument pdfDocument) {
SignatureUtil signatureUtil = new SignatureUtil(pdfDocument);
PdfAcroForm acroForm = PdfAcroForm.getAcroForm(pdfDocument, false);
List<String> signatureNames = signatureUtil.getSignatureNames();
if (signatureNames != null && signatureNames.size() > 0) {
String lastSignatureName = signatureNames.get(signatureNames.size() - 1);
PdfFormField lastSignatureField = acroForm.getField(lastSignatureName);
if (null != lastSignatureField.getPdfObject().remove(PdfName.V))
lastSignatureField.getPdfObject().setModified();
for (PdfWidgetAnnotation pdfWidgetAnnotation : lastSignatureField.getWidgets()) {
if (pdfWidgetAnnotation.getPdfObject().remove(PdfName.AP) != null)
pdfWidgetAnnotation.getPdfObject().setModified();
}
return lastSignatureName;
}
return null;
}
The signature was disappeared, but the others were invalid.
Can you help me ? Thanks.
nothing been parsed out.
I am been using the code from testRemoveLinksBySubclass() to remove URI links from PDF files created from MS Word (365) or LibreOffice. I got exceptions related to "empty action" in the annotations associated with the TOC. I examined the PDF files with RUPS and did confirm that the TOC had annotations of subtype Link but no /A thus generating an exception while trying to use the action retrieved with getAction(). I needed to add a test for a null action.
The PDF TOC created by Word and LO Writer also differs as Word creates additional /Annot type, /Link subtype ditionaries for /Border but these have a ?a -> /S : /GoTo and are not problematic. LO does not generate those additional annotations.
While the null test works for me, I wanted to document the issue.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.