> For the complete documentation index, see [llms.txt](https://docs.zapsign.com.br/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zapsign.com.br/english/facilitators/sdks/typescript-sdk/documents-requests/createdocfrompdfbase64.md).

# createDocFromPdfBase64

### Overview

Parameters:&#x20;

* [DocFromPdf](/english/facilitators/sdks/typescript-sdk/used-classes/body/docfrompdf.md)

Return:

* [DocResponse](https://docs.zapsign.com.br/facilitadores/sdks/sdk-em-typescript/classes-usadas/response/docresponse) - In case of success
* Exception - In case of failure

To create this document we will need:

* set your apiToken;
* build your signers;
* build the document;
* call the method;

### How to use:

Save your [apiToken](/english/master.md):

<pre class="language-typescript"><code class="lang-typescript"><strong>const apiToken: string = "YOUR TOKEN";
</strong></code></pre>

Set your base64:

```typescript
const base64: string = "JVBERi0xLjYKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTG..."
```

Build your signers with the [Signer](https://docs.zapsign.com.br/facilitadores/sdks/sdk-em-typescript/classes-usadas/body/signer) class:

```typescript
const signer1: Signer = new SignerBuilder()
                .withName("My First Signer")
                .build();

const signer2: Signer = new SignerBuilder()
                .withName("My Second Signer")
                .withEmail("test@test.com")
                .withLockEmail(true)
                .withLockPhone(true)
                .withPhoneCountry("55")
                .withPhoneNumber("99999999999")
                .withAuthMode("assinaturaTela") // draw on screen
                .withSendAutomaticEmail(false)
                .withSendAutomaticWhatsapp(false)
                .build();
                
let signers: Signer[] = [];
                
signers.push(signer1, signer2);
```

Build your document with the [DocFromPdfBase64](/english/facilitators/sdks/typescript-sdk/used-classes/body/docfrompdfbase64.md) class:

```typescript
const docFromPdfBase64 = DocFromPdfBase64Builder()
    .withSandbox(false)
    .withName("My Contract")
    .withBrandPrimaryColor("#000000")
    .withBase64Pdf(base64)
    .build();
```

Finally, call the createDocFromPdfBase64 method to get the [DocResponse ](/english/facilitators/sdks/typescript-sdk/used-classes/response/docresponse.md)or an error message:

<pre class="language-typescript"><code class="lang-typescript">try {
<strong>    docResponse = new DocRequests(apiToken).createDocFromPdfBase64(docFromPdfBase64);
</strong>    jsonDocResponse: string = new JsonConverter().docResponseToJson(docResponse);
    console.log(jsonDocResponse);
} catch {
     console.log(Err);
}
</code></pre>

### Example:

```typescript
import DocRequests from "sdk-node-typescript-zapsign/src/docs/DocRequests";
import { JsonConverter } from "sdk-node-typescript-zapsign/src/services/JsonConverter";

const apiToken: string = "YOUR TOKEN";

const base64: string = "JVBERi0xLjYKJcOkw7zDtsOfCjIgMCBvYmoKP...";

const signer1: Signer = new SignerBuilder()
                .withName("My First Signer")
                .build();

const signer2: Signer = new SignerBuilder()
                .withName("My Second Signer")
                .withEmail("test@test.com")
                .withLockEmail(true)
                .withLockPhone(true)
                .withPhoneCountry("55")
                .withPhoneNumber("99999999999")
                .withAuthMode("assinaturaTela") // draw on screen
                .withSendAutomaticEmail(false)
                .withSendAutomaticWhatsapp(false)
                .build();
                
let signers: Signer[] = [];
                
signers.push(signer1, signer2);

const docFromPdfBase64 = DocFromPdfBase64Builder()
    .withSandbox(false)
    .withName("My Contract")
    .withBrandPrimaryColor("#000000")
    .build();

async function exempleDocFRomPdfBase64() {
    try {
                docResponse: DocResponse = await new DocRequests(apiToken).createDocFromPdfBase64(docFromPdfBase64);
                jsonDocResponse: string = new JsonConverter().docResponseToJson(docResponse);
                console.log(jsonDocResponse);
    } catch(Err) {
                console.log(Err);
    }
  }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.zapsign.com.br/english/facilitators/sdks/typescript-sdk/documents-requests/createdocfrompdfbase64.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
