> You are reading the Docusign Developer Documentation. For clean Markdown of any page, append .md to the page URL.
>
> Documentation indexes by section:
> - APIs and SDKs: https://docusign.docs.buildwithfern.com/docs/llms.txt
> - Platform 101: https://docusign.docs.buildwithfern.com/platform/llms.txt
> - Extension Apps: https://docusign.docs.buildwithfern.com/extension-apps/llms.txt
> - Docusign CLI: https://docusign.docs.buildwithfern.com/docusign-cli/llms.txt
>
> Authentication (OAuth, JWT Grant, M2M): https://docusign.docs.buildwithfern.com/platform/auth
> Webhooks and Connect: https://docusign.docs.buildwithfern.com/platform/webhooks
>
> OpenAPI specifications: https://docusign.docs.buildwithfern.com/openapi.json
> MCP server: https://docusign.docs.buildwithfern.com/_mcp/server

# How to create an envelope for offline signing (PDF)

> Learn how to create an envelope with the Android SDK that contains a PDF file that can be used for offline signing.

This topic demonstrates how to create an [envelope](/docs/esign-rest-api/esign101/concepts/envelopes) that contains a PDF file that can be used for offline signing.

> **Note:** To sign the envelope offline, you must set the account used for authentication as either:

* the host for an [In Person Signer](https://support.docusign.com/s/document-item?rsc_301\&bundleId=gav1643676262430\&topicId=hak1578456316043.html)  or as
* a signer.

## Required data

Running the code in this how-to requires this data:

| Data element              | Description                                                                                                                                                                                                                                                            |
| ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Document to be signed     | You must provide at least one document to be signed. Document used in this how-to:- [PDF file](https://github.com/docusign/code-examples-java/blob/master/src/main/resources/World_Wide_Corp_lorem.pdf)                                                                |
| \{HOST_EMAIL}             | A string value for the email address associated with the account which will host an In Person Signer. This value must exactly match (case-sensitive) the value shown in the host’s [account profile](https://admindemo.docusign.com/authenticate?goTo=accountProfile). |
| \{HOST_NAME}              | A string value for the name associated with the account which will host an In Person Signer. This value must exactly match (case-sensitive) the value shown in the host’s [account profile](https://admindemo.docusign.com/authenticate?goTo=accountProfile).          |
| \{IN_PERSON_SIGNER_EMAIL} | A string value for the email address of the [In Person Signer](https://support.docusign.com/s/document-item?rsc_301\&bundleId=gav1643676262430\&topicId=hak1578456316043.html).                                                                                        |
| \{IN_PERSON_SIGNER_NAME}  | A string value for the name of the [In Person Signer](https://support.docusign.com/s/document-item?rsc_301\&bundleId=gav1643676262430\&topicId=hak1578456316043.html).                                                                                                 |
| \{SIGNER_EMAIL}           | A string value for the email address where the signer will receive a notification of the signing request.                                                                                                                                                              |
| \{SIGNER_NAME}            | A string value for the full name of the signer.                                                                                                                                                                                                                        |

## Step 1. Log in to Docusign

To make the API call shown in this how-to, you must be logged in to Docusign.

See [How to log in to Docusign from your app](/docs/mobile-sdks/android-sdk/how-to/log-in) for details.

## Step 2. Create an envelope definition

To create the envelope definition:

* Create a document. This includes the document’s name, filepath, and ID.
* Create your recipients. For this envelope, create an ‘in person signer’, ’signer’, and a ‘CC’ recipient. In this example, the in person signer name and email are used for the CC recipient, so that the in person signer will receive a copy of the signed document.
* Create and assign signable fields (also known as tabs) specific to each signer within the document.
* Set the envelope definition data, including a name, subject, message, recipients, and documents.

**`Java`**

```java title="Java"
File file = {DOCUMENT_FILE};
URI fileURI = file.toURL();
ArrayList<DSDocument> documents = new ArrayList<>();
DSDocument document = new DSDocument.Builder()
        .documentId(1)
        .uri(fileURI.toString())
        .name("doc1")
        .build();
documents.add(document);

ArrayList<DSTab> inPersonSignerTabs = new ArrayList<>();
inPersonSignerTabs.add(
        new DSTab.Builder()
                .documentId(1)
                .recipientId(1)
                .pageNumber(1)
                .xPosition(75)
                .yPosition(580)
                .width(50)
                .height(40)
                .type(DSTabType.SIGNATURE)
                .build()
);
ArrayList<DSTab> signerTabs = new ArrayList<>();
signerTabs.add(
        new DSTab.Builder()
                .documentId(1)
                .recipientId(2)
                .pageNumber(1)
                .xPosition(280)
                .yPosition(645)
                .width(50)
                .height(40)
                .type(DSTabType.SIGNATURE)
                .build()
);

ArrayList<DSEnvelopeRecipient> recipients = new ArrayList<>();
recipients.add(
        new DSEnvelopeRecipient.Builder()
                .recipientId(1)
                .routingOrder(1)
                .hostName("{HOST_NAME}")
                .hostEmail("{HOST_EMAIL}")
                .signerName("{IN_PERSON_SIGNER_NAME}")
                .signerEmail("{IN_PERSON_SIGNER_EMAIL}")
                .type(DSRecipientType.IN_PERSON_SIGNER)
                .tabs(inPersonSignerTabs)
                .build()
);
recipients.add(
        new DSEnvelopeRecipient.Builder()
                .recipientId(2)
                .routingOrder(2)
                .signerName("{SIGNER_NAME}")
                .signerEmail("{SIGNER_EMAIL}")
                .type(DSRecipientType.SIGNER)
                .tabs(signerTabs)
                .build()
);
recipients.add(
        new DSEnvelopeRecipient.Builder()
                .recipientId(3)
                .routingOrder(3)
                .signerName("{IN_PERSON_SIGNER_NAME}")
                .signerEmail("{IN_PERSON_SIGNER_EMAIL}")
                .type(DSRecipientType.CARBON_COPY)
                .build()
);
// DS: Envelope creation
DSEnvelope envelopeDefinition = new DSEnvelope.Builder()
        .envelopeName("Test Envelope")
        .emailSubject("Test Envelope -- Subject")
        .documents(documents)
        .recipients(recipients)
        .build();
```

**`Kotlin`**

```kotlin title="Kotlin"
val file = {DOCUMENT_FILE}
val fileURI = file.toURI()
val documents = mutableListOf<DSDocument>()
val document = DSDocument.Builder()
    .documentId(1)
    .uri(fileURI.toString())
    .name("doc1")
    .build()
documents.add(document)

val inPersonSignerTabs = mutableListOf<DSTab>()
inPersonSignerTabs.add(
    DSTab.Builder()
        .documentId(1)
        .recipientId(1)
        .pageNumber(1)
        .xPosition(75)
        .yPosition(580)
        .width(50)
        .height(40)
        .type(DSTabType.SIGNATURE)
        .build()
)

val signerTabs = mutableListOf<DSTab>()
signerTabs.add(
    DSTab.Builder()
        .documentId(1)
        .recipientId(2)
        .pageNumber(1)
        .xPosition(280)
        .yPosition(645)
        .width(50)
        .height(40)
        .type(DSTabType.SIGNATURE)
        .build()
)

val recipients = mutableListOf<DSEnvelopeRecipient>()
recipients.add(
    DSEnvelopeRecipient.Builder()
        .recipientId(1)
        .routingOrder(1)
        .hostName("{HOST_NAME}")
        .hostEmail("{HOST_EMAIL}")
        .signerName("{IN_PERSON_SIGNER_NAME}")
        .signerEmail("{IN_PERSON_SIGNER_EMAIL}")
        .type(DSRecipientType.IN_PERSON_SIGNER)
        .tabs(inPersonSignerTabs)
        .build()
)
recipients.add(
    DSEnvelopeRecipient.Builder()
        .recipientId(2)
        .routingOrder(2)
        .signerName("{SIGNER_NAME}")
        .signerEmail("{SIGNER_EMAIL}")
        .type(DSRecipientType.SIGNER)
        .tabs(signerTabs)
        .build()
)
recipients.add(
    DSEnvelopeRecipient.Builder()
        .recipientId(3)
        .routingOrder(3)
        .signerName("{IN_PERSON_SIGNER_NAME}")
        .signerEmail("{IN_PERSON_SIGNER_EMAIL}")
        .type(DSRecipientType.CARBON_COPY)
        .build()
)

// DS: Envelope creation
val envelopeDefinition = DSEnvelope.Builder()
    .envelopeName("Test Envelope")
    .emailSubject("Test Envelope -- Subject")
    .documents(documents)
    .recipients(recipients)
    .build()
```

## Step 3. Create the envelope

Next, use the definition you created in the previous step to create an envelope.

**`Java`**

```java title="Java"
DSEnvelopeDelegate envelopeDelegate = DocuSign.getInstance().getEnvelopeDelegate();
envelopeDelegate.composeAndSendEnvelope(envelopeDefinition,
    new DSComposeAndSendEnvelopeListener() {
        @Override
        public void onSuccess(String envelopeId, boolean isEnvelopeSent) {
            Log.d("composeAndSendEnvelope","envelopeId: " + envelopeId);
        }

        @Override
        public void onError(DSEnvelopeException  exception) {
            Log.e("composeAndSendEnvelope", exception.getLocalizedMessage());
        }
    }
);
```

**`Kotlin`**

```kotlin title="Kotlin"
val envelopeDelegate = DocuSign.getInstance().getEnvelopeDelegate()
envelopeDelegate.composeAndSendEnvelope(
    envelopeDefinition,
    object : DSComposeAndSendEnvelopeListener {
        override fun onSuccess(envelopeId: String, isEnvelopeSent: Boolean) {
            Log.d("composeAndSendEnvelope", "envelopeId: $envelopeId")
        }

        override fun onError(exception: DSEnvelopeException) {
            Log.e("composeAndSendEnvelope", exception.localizedMessage)
        }
    }
)
```

## Expected response

If your envelope creation is successful, the `onSuccess` method in the listener defined in the previous step will be triggered. The temporary envelope ID returned in this method can be used to start the offline signing process.

## Next steps

* See [How to start the signing process for an unsigned envelope without connectivity (offline)](/docs/mobile-sdks/android-sdk/how-to/start-signing-offline).
* Learn [How to sync offline signed envelopes](/docs/mobile-sdks/android-sdk/how-to/sync-offline).
* See [How to create an envelope for offline signing (from a template)](/docs/mobile-sdks/android-sdk/how-to/offline-signing-template).