private void populateSignatureNames() {
        if (acroForm == null) {
            return;
        }
        List<Object[]> sorter = new ArrayList<>();
        for (Map.Entry<String, PdfFormField> entry : acroForm.getFormFields().entrySet()) {
            PdfFormField field = entry.getValue();
            PdfDictionary merged = field.getPdfObject();
            if (!PdfName.Sig.equals(merged.get(PdfName.FT)))
                continue;
            PdfDictionary v = merged.getAsDictionary(PdfName.V);
            if (v == null)
                continue;
            PdfString contents = v.getAsString(PdfName.Contents);
            if (contents == null) {
                continue;
            } else {
                contents.markAsUnencryptedObject();
            }
            PdfArray ro = v.getAsArray(PdfName.ByteRange);
            if (ro == null)
                continue;
            int rangeSize = ro.size();
            if (rangeSize < 2)
                continue;
            int length = ro.getAsNumber(rangeSize - 1).intValue() + ro.getAsNumber(rangeSize - 2).intValue();
            sorter.add(new Object[]{entry.getKey(), new int[]{length, 0}});
        }
        Collections.sort(sorter, new SorterComparator());
        if (sorter.size() > 0) {
            try {
                if (((int[]) sorter.get(sorter.size() - 1)[1])[0] == document.getReader().getFileLength())
                    totalRevisions = sorter.size();
                else
                    totalRevisions = sorter.size() + 1;
            } catch (IOException e) {
                // TODO: add exception handling (at least some logger)
            }
            for (int k = 0; k < sorter.size(); ++k) {
                Object[] objs = sorter.get(k);
                String name = (String) objs[0];
                int[] p = (int[]) objs[1];
                p[1] = k + 1;
                sigNames.put(name, p);
                orderedSignatureNames.add(name);
            }
        }
    }
private void populateSignatureNames() {
        if (acroForm == null) {
            return;
        }
        List<Object[]> sorter = new ArrayList<>();
        for (Map.Entry<String, PdfFormField> entry : acroForm.getFormFields().entrySet()) {
            PdfFormField field = entry.getValue();
            PdfDictionary merged = field.getPdfObject();
            if (!PdfName.Sig.equals(merged.get(PdfName.FT)))
                continue;
            PdfDictionary v = merged.getAsDictionary(PdfName.V);
            if (v == null)
                continue;
            PdfString contents = v.getAsString(PdfName.Contents);
            if (contents == null) {
                continue;
            } else {
                contents.markAsUnencryptedObject();
            }
            PdfArray ro = v.getAsArray(PdfName.ByteRange);
            if (ro == null)
                continue;
            int rangeSize = ro.size();
            if (rangeSize < 2)
                continue;
            int length = ro.getAsNumber(rangeSize - 1).intValue() + ro.getAsNumber(rangeSize - 2).intValue();
            sorter.add(new Object[]{entry.getKey(), new int[]{length, 0}});
        }
        Collections.sort(sorter, new SorterComparator());
        if (sorter.size() > 0) {
            try {
                if (((int[]) sorter.get(sorter.size() - 1)[1])[0] == document.getReader().getFileLength())
                    totalRevisions = sorter.size();
                else
                    totalRevisions = sorter.size() + 1;
            } catch (IOException e) {
               
            }
            for (int k = 0; k < sorter.size(); ++k) {
                Object[] objs = sorter.get(k);
                String name = (String) objs[0];
                int[] p = (int[]) objs[1];
                p[1] = k + 1;
                sigNames.put(name, p);
                orderedSignatureNames.add(name);
            }
        }
    }
private void populatesignaturenames() { if (acroform == null) { return; } list<object[]> sorter = new arraylist<>(); for (map.entry<string, pdfformfield> entry : acroform.getformfields().entryset()) { pdfformfield field = entry.getvalue(); pdfdictionary merged = field.getpdfobject(); if (!pdfname.sig.equals(merged.get(pdfname.ft))) continue; pdfdictionary v = merged.getasdictionary(pdfname.v); if (v == null) continue; pdfstring contents = v.getasstring(pdfname.contents); if (contents == null) { continue; } else { contents.markasunencryptedobject(); } pdfarray ro = v.getasarray(pdfname.byterange); if (ro == null) continue; int rangesize = ro.size(); if (rangesize < 2) continue; int length = ro.getasnumber(rangesize - 1).intvalue() + ro.getasnumber(rangesize - 2).intvalue(); sorter.add(new object[]{entry.getkey(), new int[]{length, 0}}); } collections.sort(sorter, new sortercomparator()); if (sorter.size() > 0) { try { if (((int[]) sorter.get(sorter.size() - 1)[1])[0] == document.getreader().getfilelength()) totalrevisions = sorter.size(); else totalrevisions = sorter.size() + 1; } catch (ioexception e) { } for (int k = 0; k < sorter.size(); ++k) { object[] objs = sorter.get(k); string name = (string) objs[0]; int[] p = (int[]) objs[1]; p[1] = k + 1; signames.put(name, p); orderedsignaturenames.add(name); } } }