Retrieving Documents

This guide shows you how to retrieve your documents.

Any documents uploaded during the creation of a document package can be downloaded at any given time.

The Code

The EslClient.downloadDocument() method can be called both before and after the package’s completion. If called before, the documents will be flattened, removing all pending signatures and fields.

FileOutputStream stream1 = new FileOutputStream("C:/Users/hhaidary/Desktop/Example/signed_document.pdf");

// Retrieve the bytes of the document (with fields)
byte[] pdfDocumentBytes = eslClient.downloadDocument(packageId, documentId);
	    
try{
    stream1.write(pdfDocumentBytes);
} finally {
    stream1.close();
}

The EslClient.downloadOriginalDocument() method can be called both before and after the package’s completion. It retrieves the original document that was uploaded by the sender, without any signatures and fields.

FileOutputStream stream2 = new FileOutputStream("C:/Users/hhaidary/Desktop/Example/original_document.pdf");

// Retrieve the bytes of the original document (without fields)
byte[] originalPdfDocumentBytes = eslClient.downloadOriginalDocument(packageId, documentId);
	    
try{
    stream2.write(originalPdfDocumentBytes);
} finally {
    stream2.close();
}

The EslClient.downloadZippedDocuments() method can only be called after all signing has been completed. Once called, the method will deliver an archive containing all signed documents.

FileOutputStream stream3 = new FileOutputStream("C:/Users/hhaidary/Desktop/Example/signed_documents.zip");

// Retrieve the bytes of the zipped file containing all the documents in the package
byte[] zippedDocumentsBytes = eslClient.downloadZippedDocuments(packageId);
	    
try{
    stream3.write(zippedDocumentsBytes);
} finally {
    stream3.close();
}

The EslClient.downloadEvidenceSummary() method can be called both before and after the package’s completion. It retrieves the current audit trail activity for the package.

FileOutputStream stream4 = new FileOutputStream("C:/Users/hhaidary/Desktop/Example/evidence_summary.pdf");

//Retrieve the bytes of the evidence summary
byte[] evidenceBytes = eslClient.downloadEvidenceSummary(packageId);
	    
try{
    stream4.write(evidenceBytes);
} finally {
    stream4.close();
}

Running Your Code

Once you’ve run your code, you will find your files in the location where you chose to save your files.

var-122

Get the Code

Any documents uploaded during the creation of a document package can be downloaded at any given time.

The Code

The EslClient.DownloadDocument() method can be called both before and after the package’s completion. If called before, the documents will be flattened, removing all pending signatures and fields.

// Retrieve the bytes of the document (with fields)
byte[] pdfDocumentBytes = eslClient.DownloadDocument(packageId, documentId);
File.WriteAllBytes("C:/Users/hhaidary/Desktop/Example/signed_document.pdf", pdfDocumentBytes);

The EslClient.DownloadOriginalDocument() method can be called both before and after the package’s completion. It retrieves the original document that was uploaded by the sender, without any signatures and fields.

// Retrieve the bytes of the original document (without fields)
byte[] originalPdfDocumentBytes = eslClient.DownloadOriginalDocument(packageId, documentId);
File.WriteAllBytes("C:/Users/hhaidary/Desktop/Example/original_document.pdf", originalPdfDocumentBytes);

The EslClient.DownloadZippedDocuments() method can only be called after all signing has been completed. Once called, the method will deliver an archive containing all signed documents.

// Retrieve the bytes of the zipped file containing all the documents in the package
byte[] zippedDocumentsBytes = eslClient.DownloadZippedDocuments(packageId);
File.WriteAllBytes("C:/Users/hhaidary/Desktop/Example/signed_documents.zip", zippedDocumentsBytes);

The EslClient.DownloadEvidenceSummary() method can be called both before and after the package’s completion. It retrieves the current audit trail activity for the package.

//Retrieve the bytes of the evidence summary
byte[] evidenceBytes = eslClient.PackageService.DownloadEvidenceSummary(packageId);
File.WriteAllBytes("C:/Users/hhaidary/Desktop/Example/evidence_summary.pdf", evidenceBytes);

Running Your Code

Once you’ve run your code, you will find your files in the location where you chose to save your files.

var-122

Get the Code

Any documents uploaded during the creation of a document package can be downloaded at any given time.

The Code

The DownloadDocument() call can be called both before and after the package’s completion. If called before, the documents will be flattened, removing all pending signatures and fields.

HTTP Request
GET https://sandbox.esignlive.com/api/packages/{packageId}/documents/{documentId}/pdf

HTTP Headers
Accept: application/pdf
Content-Type: application/json
Authorization: Basic api_key

The DownloadOriginalDocument() call can be called both before and after the package’s completion. It retrieves the original document that was uploaded by the sender, without any signatures and fields.

HTTP Request
GET https://sandbox.esignlive.com/api/packages/{packageId}/documents/{documentId}/original

HTTP Headers
Accept: application/pdf
Content-Type: application/json
Authorization: Basic api_key

The DownloadZippedDocuments() call can only be called after all signing has been completed. Once called, the method will deliver an archive containing all signed documents.

HTTP Request
GET https://sandbox.esignlive.com/api/packages/{packageId}/documents/zip

HTTP Headers
Accept: application/zip
Content-Type: application/json
Authorization: Basic api_key

The DownloadEvidenceSummary() call can be called both before and after the package’s completion. It retrieves the current audit trail activity for the package.

HTTP Request
GET https://sandbox.esignlive.com/api/packages/{packageId}/evidence/summary

HTTP Headers
Accept: application/pdf
Content-Type: application/json
Authorization: Basic api_key

Running Your Code

Once you’ve run your code, you will find your files in the location where you chose to save your files.

var-122

Get the Code

Any documents uploaded during the creation of a document package can be downloaded at any given time.
To notice, some of the code is an extension of the APEX SDK and can be gotten through this Code Share.

The Code

The sdk.downloadDocument() method can be called both before and after the package’s completion. If called before, the documents will be flattened, removing all pending signatures and fields.

    	//download signed document
    	Blob signedDocument = sdk.downloadDocument(packageId, documentId);
        Document doc1 = new Document();
        doc1.Body = signedDocument;
        doc1.FolderId = folder.id;
        doc1.Name = 'test retrieving document - sigend document';
        doc1.Type = 'pdf';
    	insert doc1;

The encapsulated downloadOriginalDocument() method can be called both before and after the package’s completion. It retrieves the original document that was uploaded by the sender, without any signatures and fields.

    	//download original document
    	Blob originalDocument = downloadOriginalDocument(packageId, documentId);
        Document doc2 = new Document();
        doc2.Body = originalDocument;
        doc2.FolderId = folder.id;
        doc2.Name = 'test retrieving document - original document';
        doc2.Type = 'pdf';
    	insert doc2;

The encapsulated downloadZippedDocuments() method can only be called after all signing has been completed. Once called, the method will deliver an archive containing all signed documents.

    	//download zipped document
    	Blob zippedDocuments = downloadZippedDocuments(packageId);
        Document doc3 = new Document();
        doc3.Body = zippedDocuments;
        doc3.FolderId = folder.id;
        doc3.Name = 'test retrieving document - zipped documents';
        doc3.Type = 'zip';
    	insert doc3;

The sdk.getAudit() method can be called both before and after the package’s completion. It retrieves the current audit trail activity for the package.

    	//download evidence summary
    	String auditString= sdk.getAudit(packageId);
        Document doc4 = new Document();
        doc4.Body = EncodingUtil.base64Decode(auditString);
        doc4.FolderId = folder.id;
        doc4.Name = 'test retrieving document - evidence summary';
        doc4.Type = 'pdf';
    	insert doc4;

Running Your Code

Once you’ve run your code, you will find your files in the location where you chose to save your files.
Capture
Get the Code