Skip to main content

AssociatedFileRelationship Enum

Specifies the relationship between an associated file and the PDF document.

Declaration

public enum AssociatedFileRelationship extends Enum<AssociatedFileRelationship> implements IIntEnum

Members

Name Description
ALTERNATIVE

Specifies that the file is an alternative representation of the document content.

DATA

Specifies that the file contains data associated with the document.

ENCRYPTED_PAYLOAD

Specifies that the file contains encrypted payload data.

SOURCE

Specifies that the file is the source for the document content.

SUPPLEMENT

Specifies that the file supplements the document content.

UNSPECIFIED

Specifies that the file relationship is not defined.

fromValue(int value)

Returns the enum value that corresponds to the specified integer.

getName()

Returns the name of this enum value.

getValue()

Returns the integer value of this enum item.

toString()

Returns the string representation of this enum value.

valueOf(String name)

Returns the enum value with the specified name.

values()

Returns an array that contains all enum values.

Remarks

The following code snippet attaches an XML file to a PDF document and marks it as the source document:

import com.devexpress.docs.pdf.*;
import java.nio.file.*;

try (PdfDocument pdfDocument = new PdfDocument()) {

    // Add an A4-size page to the document.
    pdfDocument.getPages().add(DXPaperKind.A4);

    Attachment attachment = new Attachment(
            "invoice.xml",
            Files.readAllBytes(Path.of("invoice.xml")));

    // Specify the MIME type.
    attachment.setMimeType("application/xml");

    // Specify how the embedded file is related to the PDF document.
    attachment.setRelationship(AssociatedFileRelationship.SOURCE);

    // Add the attachment to the document.
    pdfDocument.getAttachments().add(attachment);

    // Save the document.
    try (WritableByteChannel channel =
        FileChannel.open(Path.of("result.pdf"),
            StandardOpenOption.CREATE,
            StandardOpenOption.WRITE,
            StandardOpenOption.TRUNCATE_EXISTING)) {

        pdfDocument.save(channel);
    }
}

Implements

com.devexpress.java.enums.IIntEnum

Inherited Members

java.lang.Enum.<T>valueOf(java.lang.Class<T>,java.lang.String)
java.lang.Enum.clone()
java.lang.Enum.compareTo(E)
java.lang.Enum.describeConstable()
java.lang.Enum.equals(java.lang.Object)
java.lang.Enum.finalize()
java.lang.Enum.getDeclaringClass()
java.lang.Enum.hashCode()
java.lang.Enum.name()
java.lang.Enum.ordinal()
java.lang.Enum.toString()
java.lang.Object.getClass()
java.lang.Object.notify()
java.lang.Object.notifyAll()
java.lang.Object.wait()
java.lang.Object.wait(long)
java.lang.Object.wait(long,int)

Inheritance

Object
java.lang.Enum
AssociatedFileRelationship