Example usage for com.itextpdf.text.pdf PdfName FILESPEC

List of usage examples for com.itextpdf.text.pdf PdfName FILESPEC

Introduction

In this page you can find the example usage for com.itextpdf.text.pdf PdfName FILESPEC.

Prototype

PdfName FILESPEC

To view the source code for com.itextpdf.text.pdf PdfName FILESPEC.

Click Source Link

Document

A name

Usage

From source file:org.sejda.impl.itext5.component.PdfUnpacker.java

License:Open Source License

private void unpack(Set<PdfDictionary> dictionaries) throws TaskIOException {
    for (PdfDictionary dictionary : dictionaries) {
        PdfName type = dictionary.getAsName(PdfName.TYPE);
        if (PdfName.F.equals(type) || PdfName.FILESPEC.equals(type)) {
            PdfDictionary ef = dictionary.getAsDict(PdfName.EF);
            PdfString fn = dictionary.getAsString(PdfName.F);
            if (fn != null && ef != null) {
                PRStream prs = (PRStream) PdfReader.getPdfObject(ef.get(PdfName.F));
                if (prs != null) {
                    File tmpFile = copyToTemporaryFile(prs);
                    outputWriter.addOutput(file(tmpFile).name(fn.toUnicodeString()));
                }/*from   ww w .  j  av a 2s.  c  o  m*/
            }
        }
    }
}