Example usage for org.apache.pdfbox.pdmodel.common.filespecification PDComplexFileSpecification getEmbeddedFileUnicode

List of usage examples for org.apache.pdfbox.pdmodel.common.filespecification PDComplexFileSpecification getEmbeddedFileUnicode

Introduction

In this page you can find the example usage for org.apache.pdfbox.pdmodel.common.filespecification PDComplexFileSpecification getEmbeddedFileUnicode.

Prototype

public PDEmbeddedFile getEmbeddedFileUnicode() 

Source Link

Document

Get the embedded unicode file.

Usage

From source file:dev.ztgnrw.ExtractEmbeddedFiles.java

License:Apache License

private static PDEmbeddedFile getEmbeddedFile(PDComplexFileSpecification fileSpec) {
    // search for the first available alternative of the embedded file
    PDEmbeddedFile embeddedFile = null;//from  w  ww  . ja  va  2s .  c om
    if (fileSpec != null) {
        embeddedFile = fileSpec.getEmbeddedFileUnicode();
        if (embeddedFile == null) {
            embeddedFile = fileSpec.getEmbeddedFileDos();
        }
        if (embeddedFile == null) {
            embeddedFile = fileSpec.getEmbeddedFileMac();
        }
        if (embeddedFile == null) {
            embeddedFile = fileSpec.getEmbeddedFileUnix();
        }
        if (embeddedFile == null) {
            embeddedFile = fileSpec.getEmbeddedFile();
        }
    }
    return embeddedFile;
}

From source file:org.pdfmetamodifier.IOHelper.java

License:Apache License

private static PDEmbeddedFile getEmbeddedFile(final PDComplexFileSpecification fileSpec) {
    // Search for the first available alternative of the Embedded (attached) file.
    if (fileSpec != null) {
        //@formatter:off
        final PDEmbeddedFile[] files = { fileSpec.getEmbeddedFileUnicode(), fileSpec.getEmbeddedFileUnix(),
                fileSpec.getEmbeddedFileDos(), fileSpec.getEmbeddedFileMac(), fileSpec.getEmbeddedFile() };
        //@formatter:on

        for (PDEmbeddedFile embeddedFile : files) {
            if (embeddedFile != null) {
                return embeddedFile;
            }// w w  w . j  a  v  a2  s  . c o  m
        }
    }

    return null;
}