Question

Couldn't recognize fields from Base64

  • 26 January 2024
  • 1 reply
  • 18 views

Badge +1

Hi,

I set Base64 document to EnvelopeDefinition, but it return null when calling getEnvelopeDocGenFormFields.

 

byte[] fileBytes = Files.readAllBytes(Paths.get("/Users/.../Document_Template.docx"));
Document document = new Document();
document.setDocumentBase64(Base64.getEncoder().encodeToString(fileBytes));
document.setName("SampleDocument.docx");
document.setFileExtension("docx");
document.setDocumentId("1");

ArrayList<Document> documents = new ArrayList<>();
documents.add(document);
envelopeDefinition.setDocuments(documents);
final EnvelopeSummary envelopeSummary = envelopesApi.createEnvelope(accountId, envelopeDefinition);
final String envelopeId = envelopeSummary.getEnvelopeId();

// Get Fields from document that need to be merged with custom data
final DocGenFormFieldResponse formFieldResponse =
envelopesApi.getEnvelopeDocGenFormFields(accountId, envelopeId);


1 reply

Badge +1

Hi all,

I am trying to upload a document with valid form fields to a new envelope, but getEnvelopeDocGenFormFields can't recognize any fields from Base64. code. I am sure that the form of the document(docx) is valid.

 

byte[] fileBytes = Files.readAllBytes(Paths.get("/Users/.../Document_Template.docx"));

Document document = new Document();

document.setDocumentBase64(Base64.getEncoder().encodeToString(fileBytes));

document.setName("SampleDocument.docx");

document.setFileExtension("docx");

document.setDocumentId("1");

 

ArrayList<Document> documents = new ArrayList<>();

documents.add(document);

envelopeDefinition.setDocuments(documents);

final EnvelopeSummary envelopeSummary = envelopesApi.createEnvelope(accountId, envelopeDefinition);

final String envelopeId = envelopeSummary.getEnvelopeId();

 

// Step 3 - Get Fields from document that need to be merged with custom data

final DocGenFormFieldResponse formFieldResponse =
envelopesApi.getEnvelopeDocGenFormFields(accountId, envelopeId);

 

result:

formFieldResponse.docGenFormFields == null

Reply