Coder Social home page Coder Social logo

testarea-itext7's People

Contributors

dependabot[bot] avatar mkl-public avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

testarea-itext7's Issues

when i remove a signature from a pdf which I signed many times, signatures left are invalid

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.

Before:
before

After:
after

Can you help me ? Thanks.

Removing links and Word and LibreOffice Writer TOC link annotations

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.