function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Milan VadhiaMilan Vadhia 

Adobe Sign - EchoSign App Help!

Hello,

I want to send Visualforce page as pdf in email for e-sign using Adobe EchoSign When clicked on command button on Visualforce page. This Visualforce page contains data from multiple objects. How can I send this page for signature using Adobe EchoSign? Please help asap.
Best Answer chosen by Milan Vadhia
Ryan GreeneRyan Greene
I inserted the code of the VF Page and Apex Controller I created to do what you're wanting to do. For further Adobe Sign custom tags you'll need to check out their documentation here: https://helpx.adobe.com/sign/help/adobesign_text_tag_guide.html

Sorry it's so long, but all of my notes are added in line!

VF Page which Renders PDF for Adobe Sign/Echo Sign:
<apex:page controller="ProposalEC" renderAs="pdf">
    <!-- Adds the image from a Static Resource 
      Custom creation by Ryan Greene ryan.greene@outlook.com-->
    <apex:image url="{!$Resource.FILENAMEHERE}" style="left;" width="15%" height="15%"/>
    <html>
        <br/>
    </html>
    <!-- Section rendered only if Entity field equals ENTITY1 - Use API names to render -->
    <apex:outputPanel id="ent1" rendered="{!Ld[0].Entity__c == 'ENTITY1'}">  
        <html>
            Entity 1
        </html>
    </apex:outputPanel>
    <!-- Section rendered only if Entity field equals ENTITY2 - Use API names to render -->
    <apex:outputPanel id="ent2" rendered="{!Ld[0].Entity__c == 'ENTITY2'}">  
        <html>
            Entity 2
        </html>
    </apex:outputPanel>
    <apex:outputText value="{0,date,MMMM dd, yyyy}">
        <apex:param value="{!TODAY()}" />
    </apex:outputText>
    <html>
        For: {!Ld[0].Company}<br/>
        {!Ld[0].Street}<br/>
        {!Ld[0].City}, {!Ld[0].State} {!Ld[0].PostalCode}<br/>          
        {!Com[0].Name}<br/><br/><br/><br/>
        {!Ld[0].FirstName},<br/><br/>
        I'm pleased to present {!Ld[0].Company} ("Client") with the following terms for a financing facility (the "Facility").<br/><br/>
        <b>Facility Size:</b> ${!IF(Com[0].PRC_Facility_Size__c < 1000, TEXT(ROUND(Com[0].PRC_Facility_Size__c,0)), 
        IF(Com[0].PRC_Facility_Size__c < 1000000, TEXT(FLOOR(ROUND(Com[0].PRC_Facility_Size__c,0) /1000)) 
        & ',' & RIGHT(TEXT(ROUND(Com[0].PRC_Facility_Size__c,0)), LEN(TEXT(ROUND(Com[0].PRC_Facility_Size__c,0))) - LEN(TEXT(FLOOR(ROUND(Com[0].PRC_Facility_Size__c,0) /1000)))), 
        IF(Com[0].PRC_Facility_Size__c < 1000000000, TEXT(FLOOR(ROUND(Com[0].PRC_Facility_Size__c,0) /1000000)) 
        & ',' & MID(TEXT(ROUND(Com[0].PRC_Facility_Size__c,0)), 1 + LEN(TEXT(1 + FLOOR(ROUND(Com[0].PRC_Facility_Size__c,0) /1000000))),3) 
        & ',' & RIGHT(TEXT(ROUND(Com[0].PRC_Facility_Size__c,0)), LEN(TEXT(ROUND(Com[0].PRC_Facility_Size__c,0))) - LEN(TEXT(FLOOR(ROUND(Com[0].PRC_Facility_Size__c,0) /1000)))), 
        NULL)))}.<br/><br/>
        <b>Advance Rate:</b> Up to {!Com[0].PRC_Advance_Rate__c}% on Client’s eligible accounts receivable.<br/>
    </html>
    <apex:outputPanel id="ARI" rendered="{!Com[0].PRC_Advance_Rate_Inventory__c != null}">  
        <html>
            <b>Advance Rate Inventory:</b> The lesser of 1) 65% of Net Orderly Liquidation Value as determined by an Inventory Appraiser acceptable to {!Ld[0].Entity__c} and 2) 50% of Eligible A/R and 3) the Inventory Sublimit, 
            ${!IF(Com[0].PRC_Inventory_Sublimit__c < 1000, TEXT(ROUND(Com[0].PRC_Inventory_Sublimit__c,0)), 
            IF(Com[0].PRC_Inventory_Sublimit__c < 1000000, TEXT(FLOOR(ROUND(Com[0].PRC_Inventory_Sublimit__c,0) /1000)) 
            & ',' & RIGHT(TEXT(ROUND(Com[0].PRC_Inventory_Sublimit__c,0)), LEN(TEXT(ROUND(Com[0].PRC_Inventory_Sublimit__c,0))) - LEN(TEXT(FLOOR(ROUND(Com[0].PRC_Inventory_Sublimit__c,0) /1000)))), 
            IF(Com[0].PRC_Inventory_Sublimit__c < 1000000000, TEXT(FLOOR(ROUND(Com[0].PRC_Inventory_Sublimit__c,0) /1000000)) 
            & ',' & MID(TEXT(ROUND(Com[0].PRC_Inventory_Sublimit__c,0)), 1 + LEN(TEXT(1 + FLOOR(ROUND(Com[0].PRC_Inventory_Sublimit__c,0) /1000000))),3) 
            & ',' & RIGHT(TEXT(ROUND(Com[0].PRC_Inventory_Sublimit__c,0)), LEN(TEXT(ROUND(Com[0].PRC_Inventory_Sublimit__c,0))) - LEN(TEXT(FLOOR(ROUND(Com[0].PRC_Inventory_Sublimit__c,0) /1000)))), 
            NULL)))}.
        </html>
    </apex:outputPanel>
    <apex:outputPanel id="IPF" rendered="{!Com[0].PRC_Fee_Invoice_Purchase__c != null}">  
        <html>
            <b>Invoice Purchase Fee:</b> {!Com[0].PRC_Fee_Invoice_Purchase__c}% on the gross amount of all invoices submitted to {!Ld[0].Entity__c} for funding.
        </html>
    </apex:outputPanel>    
    <apex:outputPanel id="IMF" rendered="{!Com[0].PRC_Fee_Inventory_Monitoring__c != null}">  
        <html>
            <b>Inventory Monitoring Fee:</b> {!Com[0].PRC_Fee_Inventory_Monitoring__c}%.<br/><br/>
            <b>Inventory Advance Formula:</b> The lesser of 1) 65% of Net Orderly Liquidation Value as determined by an Inventory Appraiser acceptable) 50% of Eligible A/R and 3) the Inventory Sublimit.
        </html>
    </apex:outputPanel>
    <apex:outputPanel id="FUF" rendered="{!Com[0].PRC_Fee_Funds_Usage_Daily__c != null}">  
        <html>
            <b>Funds Usage Daily Fee:</b> {!Com[0].PRC_Fee_Funds_Usage_Daily__c}%. The Funds Usage Daily Fee shall increase or decrease on the same date as any change in the Prime Rate, by the Prime Rate Adjustment.<br/><br/>
            <b>Prime Rate:</b> The prime rate published by the Wall Street Journal, from time to time as its prime rate.<br/><br/>
            <b>Prime Rate Adjustment:</b> 0.0007% for every 0.25% change in the Prime Rate compared to the existing Prime Rate.
        </html>
    </apex:outputPanel>
    <apex:outputPanel id="ACF" rendered="{!Com[0].PRC_Fee_Aging_Collection__c != null}">  
        <html>
            <b>Aging &amp; Collection Fee:</b> An aging and collection fee of {!Com[0].PRC_Fee_Aging_Collection__c}% of the face value of the purchased invoices for every {!Com[0].PRC_Aging_Collection_Every_X_Days__c} days outstanding beyond {!Com[0].PRC_Aging_Collection_Beyond_X_Days__c} days.
        </html>
    </apex:outputPanel>
    <apex:outputPanel id="FAF" rendered="{!Com[0].PRC_Fee_Field_Appraisal__c != null}">  
        <html>
            <b>Field Appraisal Deposit:</b> ${!IF(Com[0].PRC_Fee_Field_Appraisal__c < 1000, TEXT(ROUND(Com[0].PRC_Fee_Field_Appraisal__c,0)), 
            IF(Com[0].PRC_Fee_Field_Appraisal__c < 1000000, TEXT(FLOOR(ROUND(Com[0].PRC_Fee_Field_Appraisal__c,0) /1000)) 
            & ',' & RIGHT(TEXT(ROUND(Com[0].PRC_Fee_Field_Appraisal__c,0)), LEN(TEXT(ROUND(Com[0].PRC_Fee_Field_Appraisal__c,0))) - LEN(TEXT(FLOOR(ROUND(Com[0].PRC_Fee_Field_Appraisal__c,0) /1000)))), 
            IF(Com[0].PRC_Fee_Field_Appraisal__c < 1000000000, TEXT(FLOOR(ROUND(Com[0].PRC_Fee_Field_Appraisal__c,0) /1000000)) 
            & ',' & MID(TEXT(ROUND(Com[0].PRC_Fee_Field_Appraisal__c,0)), 1 + LEN(TEXT(1 + FLOOR(ROUND(Com[0].PRC_Fee_Field_Appraisal__c,0) /1000000))),3) 
            & ',' & RIGHT(TEXT(ROUND(Com[0].PRC_Fee_Field_Appraisal__c,0)), LEN(TEXT(ROUND(Com[0].PRC_Fee_Field_Appraisal__c,0))) - LEN(TEXT(FLOOR(ROUND(Com[0].PRC_Fee_Field_Appraisal__c,0) /1000)))), 
            NULL)))} paid upon signing of proposal.
        </html>
    </apex:outputPanel>
    <apex:outputPanel id="FEF" rendered="{!Com[0].PRC_Fee_Field_Exam__c != null}">  
        <html>
            <b>Field Exam Deposit:</b> ${!IF(Com[0].PRC_Fee_Field_Exam__c < 1000, TEXT(ROUND(Com[0].PRC_Fee_Field_Exam__c,0)), 
            IF(Com[0].PRC_Fee_Field_Exam__c < 1000000, TEXT(FLOOR(ROUND(Com[0].PRC_Fee_Field_Exam__c,0) /1000)) 
            & ',' & RIGHT(TEXT(ROUND(Com[0].PRC_Fee_Field_Exam__c,0)), LEN(TEXT(ROUND(Com[0].PRC_Fee_Field_Exam__c,0))) - LEN(TEXT(FLOOR(ROUND(Com[0].PRC_Fee_Field_Exam__c,0) /1000)))), 
            IF(Com[0].PRC_Fee_Field_Exam__c < 1000000000, TEXT(FLOOR(ROUND(Com[0].PRC_Fee_Field_Exam__c,0) /1000000)) 
            & ',' & MID(TEXT(ROUND(Com[0].PRC_Fee_Field_Exam__c,0)), 1 + LEN(TEXT(1 + FLOOR(ROUND(Com[0].PRC_Fee_Field_Exam__c,0) /1000000))),3) 
            & ',' & RIGHT(TEXT(ROUND(Com[0].PRC_Fee_Field_Exam__c,0)), LEN(TEXT(ROUND(Com[0].PRC_Fee_Field_Exam__c,0))) - LEN(TEXT(FLOOR(ROUND(Com[0].PRC_Fee_Field_Exam__c,0) /1000)))), 
            NULL)))} paid upon signing of proposal.
        </html>
    </apex:outputPanel>
    <apex:outputPanel id="PF" rendered="{!Com[0].PRC_Fee_Proposal__c != null}">  
        <html>
            <b>Proposal Fee:</b> ${!IF(Com[0].PRC_Fee_Proposal__c < 1000, TEXT(ROUND(Com[0].PRC_Fee_Proposal__c,0)), 
            IF(Com[0].PRC_Fee_Proposal__c < 1000000, TEXT(FLOOR(ROUND(Com[0].PRC_Fee_Proposal__c,0) /1000)) 
            & ',' & RIGHT(TEXT(ROUND(Com[0].PRC_Fee_Proposal__c,0)), LEN(TEXT(ROUND(Com[0].PRC_Fee_Proposal__c,0))) - LEN(TEXT(FLOOR(ROUND(Com[0].PRC_Fee_Proposal__c,0) /1000)))), 
            IF(Com[0].PRC_Fee_Proposal__c < 1000000000, TEXT(FLOOR(ROUND(Com[0].PRC_Fee_Proposal__c,0) /1000000)) 
            & ',' & MID(TEXT(ROUND(Com[0].PRC_Fee_Proposal__c,0)), 1 + LEN(TEXT(1 + FLOOR(ROUND(Com[0].PRC_Fee_Proposal__c,0) /1000000))),3) 
            & ',' & RIGHT(TEXT(ROUND(Com[0].PRC_Fee_Proposal__c,0)), LEN(TEXT(ROUND(Com[0].PRC_Fee_Proposal__c,0))) - LEN(TEXT(FLOOR(ROUND(Com[0].PRC_Fee_Proposal__c,0) /1000)))), 
            NULL)))} paid at close out of initial funding.
        </html>
    </apex:outputPanel>
    <apex:outputPanel id="DDF" rendered="{!Com[0].PRC_Fee_Due_Diligence__c != null}">  
        <html>
            <b>Due Diligence Fee:</b> ${!IF(Com[0].PRC_Fee_Due_Diligence__c < 1000, TEXT(ROUND(Com[0].PRC_Fee_Due_Diligence__c,0)), 
            IF(Com[0].PRC_Fee_Due_Diligence__c < 1000000, TEXT(FLOOR(ROUND(Com[0].PRC_Fee_Due_Diligence__c,0) /1000)) 
            & ',' & RIGHT(TEXT(ROUND(Com[0].PRC_Fee_Due_Diligence__c,0)), LEN(TEXT(ROUND(Com[0].PRC_Fee_Due_Diligence__c,0))) - LEN(TEXT(FLOOR(ROUND(Com[0].PRC_Fee_Due_Diligence__c,0) /1000)))), 
            IF(Com[0].PRC_Fee_Due_Diligence__c < 1000000000, TEXT(FLOOR(ROUND(Com[0].PRC_Fee_Due_Diligence__c,0) /1000000)) 
            & ',' & MID(TEXT(ROUND(Com[0].PRC_Fee_Due_Diligence__c,0)), 1 + LEN(TEXT(1 + FLOOR(ROUND(Com[0].PRC_Fee_Due_Diligence__c,0) /1000000))),3) 
            & ',' & RIGHT(TEXT(ROUND(Com[0].PRC_Fee_Due_Diligence__c,0)), LEN(TEXT(ROUND(Com[0].PRC_Fee_Due_Diligence__c,0))) - LEN(TEXT(FLOOR(ROUND(Com[0].PRC_Fee_Due_Diligence__c,0) /1000)))), 
            NULL)))} paid upon signing of proposal.
        </html>
    </apex:outputPanel>
    <apex:outputPanel id="CT" rendered="{!Com[0].PRC_Special_Pricing__c != null}">  
        <html>
            <b>Custom Terms:</b> {!Com[0].PRC_Special_Pricing__c}
        </html>
    </apex:outputPanel>
    <html>
        <b>Collateral:</b> A first priority, security interest in [Collateral] of Client.<br/><br/>
        
        <b>Lockbox:</b> All payments and other collections of Client’s accounts will be mailed, wired, or sent via ACH by Client’s customers to and administered through {!Ld[0].Entity__c}’s lockbox. All collections received by {!Ld[0].Entity__c} will decrease the amount of Funds Employed.<br/><br/>
        
        <b>Individual Guarantee(s):</b> Guarantees may be required from Client’s owners and shareholders as determined by {!Ld[0].Entity__c}.<br/><br/>
        
        <b>Term:</b> The term of the Facility will be 12 months, with successive 12 month renewals. <br/><br/>
        
        <b>Target Closing Date:</b> By &nbsp;<apex:outputText value="{0,date,MMMM dd, yyyy}"><apex:param value="{!Ld[0].Date_Target_Close__c}" /></apex:outputText>.<br/><br/>
        
        <b>Closing Conditions:</b> [Closing Conditions]<br/><br/>
        
        If the foregoing correctly sets forth your understanding of the proposed financing described herein, please indicate your acceptance of this proposal by signing no later than [Proposal Deadline].<br/><br/>
        
        This proposal does not constitute a commitment from {!Ld[0].Entity__c} or {!Ld[0].Company} to enter into a binding contract to provide financing, nor an undertaking to provide financing, with the express exception of the paragraphs entitled “Fees” and “Expenses”, which the parties intend to become binding at the time that this proposal is accepted.<br/><br/>
        
        Sincerely,<br/><br/>
        
        {{*Sig_es_:signer1:signature}}<br/><br/>
        
        {!us[0].FirstName} {!us[0].LastName}<br/>
    </html>
    <apex:outputPanel id="ent1" rendered="{!Ld[0].Entity__c == 'ent1'}">  
        <html>
            LS DE LLC<br/>
        </html>
    </apex:outputPanel>
    <apex:outputPanel id="ent2" rendered="{!Ld[0].Entity__c == 'ent2'}">  
        <html>
        </html>
    </apex:outputPanel>
    <html>
        {{*Sig_es_:signer2:signature}}
    </html>
<!--Custom creation by Ryan Greene ryan.greene@outlook.com-->
</apex:page>

Apex Controller:
public class ProposalEC {
    //this first section is for the VF page 'Proposal' to pull the needed information from the Lead, Component, and User objects
    //Each List "gets" the records based on the query below , and "sets" the information for use from the VF Page
//Custom creation by Ryan Greene ryan.greene@outlook.com
    public List<Lead> Ld {get;set;}
    public List<Component__c> Com {get;set;}
    public List<User> us {get;set;}
    //gets the Id of the current record
    public Id getid {get;set;}{
        getid = ApexPages.currentPage().getParameters().get('id');}    
    //method to get the proper records and all needed fields for the VF Page
    public ProposalEC(){
        Ld = [SELECT Id, OwnerId, City, State, PostalCode, Street, Entity__c, Date_Target_Close__c, Company,
              FirstName, LastName FROM Lead WHERE Id =: getid];
        Com = [SELECT Id, PRC_Facility_Size__c,PRC_Advance_Rate__c,PRC_Aging_Collection_Every_X_Days__c,PRC_Aging_Collection_Beyond_X_Days__c,PRC_Fee_Aging_Collection__c,PRC_Fee_Funds_Usage_Daily__c,
               PRC_Fee_Inventory_Monitoring__c,PRC_Fee_Invoice_Purchase__c,PRC_Advance_Rate_Inventory__c,PRC_Inventory_Sublimit__c,
               Name,PRC_Fee_Field_Appraisal__c,PRC_Fee_Field_Exam__c,PRC_Fee_Proposal__c,PRC_Fee_Due_Diligence__c,PRC_Special_Pricing__c
               FROM Component__c WHERE RecordTypeId = '0123F0000008XdC' AND Active_Component__c = True AND Related_Lead__c =: Ld[0].Id];
        us = [SELECT FirstName, LastName FROM User WHERE Id =: Ld[0].OwnerId];
    }
    //This section takes the Lead based on variable above 'getid' and creates an Adobe Sign Agreement and PDF based on its information 
    private ApexPages.StandardController standardController;
    public ProposalEC(ApexPages.StandardController standardController){
        this.standardController = standardController;}
    List<Lead> led = [SELECT Id, Name FROM Lead WHERE Id =: getid LIMIT 1];
    
    public pageReference SendPdf2(){
        //Tells the VF Page Proposal where to access the Lead information. Then sets the body of the pdf for later use
        pageReference pdfPage = Page.Proposal;
        pdfPage.getParameters().put('Id',getid);
        blob pdfBody;
        if(Test.isRunningTest()){
            pdfBody = blob.valueOf('Unit.Test');
        }else{
            pdfBody = pdfPage.getContentAsPDF();}
        //Creates the AdobeSign Agreement
        echosign_dev1__SIGN_Agreement__c agreementRec = new echosign_dev1__SIGN_Agreement__c();
        agreementRec.Name                                    = 'Proposal for: '+led[0].Name;
        agreementRec.echosign_dev1__Signaturetype__c         = 'e-Signature';
        agreementRec.echosign_dev1__Recipient_Lead__c        = led[0].Id;
        agreementRec.echosign_dev1__Enable_Hosted_Signing__c = true;
        insert agreementRec;
        //Creates the attachment pdf for the Agreement
        attachment pdfFile = new attachment();
        pdfFile.isPrivate  = false;
        pdfFile.body       = pdfBody;
        pdfFile.parentId   = agreementRec.id;
        pdfFile.Name       = 'Proposal for: '+led[0].Name+'.pdf';
        insert pdfFile;
        //Redirects the user to the Adobe Sign Agreement screen so they can preview and send immediately if needed
        PageReference pageref = new PageReference('/' + agreementRec.id);
        pageref.setRedirect(false);
        return pageref;
    }
}
//Custom creation by Ryan Greene ryan.greene@outlook.com


 

All Answers

Ryan GreeneRyan Greene
I inserted the code of the VF Page and Apex Controller I created to do what you're wanting to do. For further Adobe Sign custom tags you'll need to check out their documentation here: https://helpx.adobe.com/sign/help/adobesign_text_tag_guide.html

Sorry it's so long, but all of my notes are added in line!

VF Page which Renders PDF for Adobe Sign/Echo Sign:
<apex:page controller="ProposalEC" renderAs="pdf">
    <!-- Adds the image from a Static Resource 
      Custom creation by Ryan Greene ryan.greene@outlook.com-->
    <apex:image url="{!$Resource.FILENAMEHERE}" style="left;" width="15%" height="15%"/>
    <html>
        <br/>
    </html>
    <!-- Section rendered only if Entity field equals ENTITY1 - Use API names to render -->
    <apex:outputPanel id="ent1" rendered="{!Ld[0].Entity__c == 'ENTITY1'}">  
        <html>
            Entity 1
        </html>
    </apex:outputPanel>
    <!-- Section rendered only if Entity field equals ENTITY2 - Use API names to render -->
    <apex:outputPanel id="ent2" rendered="{!Ld[0].Entity__c == 'ENTITY2'}">  
        <html>
            Entity 2
        </html>
    </apex:outputPanel>
    <apex:outputText value="{0,date,MMMM dd, yyyy}">
        <apex:param value="{!TODAY()}" />
    </apex:outputText>
    <html>
        For: {!Ld[0].Company}<br/>
        {!Ld[0].Street}<br/>
        {!Ld[0].City}, {!Ld[0].State} {!Ld[0].PostalCode}<br/>          
        {!Com[0].Name}<br/><br/><br/><br/>
        {!Ld[0].FirstName},<br/><br/>
        I'm pleased to present {!Ld[0].Company} ("Client") with the following terms for a financing facility (the "Facility").<br/><br/>
        <b>Facility Size:</b> ${!IF(Com[0].PRC_Facility_Size__c < 1000, TEXT(ROUND(Com[0].PRC_Facility_Size__c,0)), 
        IF(Com[0].PRC_Facility_Size__c < 1000000, TEXT(FLOOR(ROUND(Com[0].PRC_Facility_Size__c,0) /1000)) 
        & ',' & RIGHT(TEXT(ROUND(Com[0].PRC_Facility_Size__c,0)), LEN(TEXT(ROUND(Com[0].PRC_Facility_Size__c,0))) - LEN(TEXT(FLOOR(ROUND(Com[0].PRC_Facility_Size__c,0) /1000)))), 
        IF(Com[0].PRC_Facility_Size__c < 1000000000, TEXT(FLOOR(ROUND(Com[0].PRC_Facility_Size__c,0) /1000000)) 
        & ',' & MID(TEXT(ROUND(Com[0].PRC_Facility_Size__c,0)), 1 + LEN(TEXT(1 + FLOOR(ROUND(Com[0].PRC_Facility_Size__c,0) /1000000))),3) 
        & ',' & RIGHT(TEXT(ROUND(Com[0].PRC_Facility_Size__c,0)), LEN(TEXT(ROUND(Com[0].PRC_Facility_Size__c,0))) - LEN(TEXT(FLOOR(ROUND(Com[0].PRC_Facility_Size__c,0) /1000)))), 
        NULL)))}.<br/><br/>
        <b>Advance Rate:</b> Up to {!Com[0].PRC_Advance_Rate__c}% on Client’s eligible accounts receivable.<br/>
    </html>
    <apex:outputPanel id="ARI" rendered="{!Com[0].PRC_Advance_Rate_Inventory__c != null}">  
        <html>
            <b>Advance Rate Inventory:</b> The lesser of 1) 65% of Net Orderly Liquidation Value as determined by an Inventory Appraiser acceptable to {!Ld[0].Entity__c} and 2) 50% of Eligible A/R and 3) the Inventory Sublimit, 
            ${!IF(Com[0].PRC_Inventory_Sublimit__c < 1000, TEXT(ROUND(Com[0].PRC_Inventory_Sublimit__c,0)), 
            IF(Com[0].PRC_Inventory_Sublimit__c < 1000000, TEXT(FLOOR(ROUND(Com[0].PRC_Inventory_Sublimit__c,0) /1000)) 
            & ',' & RIGHT(TEXT(ROUND(Com[0].PRC_Inventory_Sublimit__c,0)), LEN(TEXT(ROUND(Com[0].PRC_Inventory_Sublimit__c,0))) - LEN(TEXT(FLOOR(ROUND(Com[0].PRC_Inventory_Sublimit__c,0) /1000)))), 
            IF(Com[0].PRC_Inventory_Sublimit__c < 1000000000, TEXT(FLOOR(ROUND(Com[0].PRC_Inventory_Sublimit__c,0) /1000000)) 
            & ',' & MID(TEXT(ROUND(Com[0].PRC_Inventory_Sublimit__c,0)), 1 + LEN(TEXT(1 + FLOOR(ROUND(Com[0].PRC_Inventory_Sublimit__c,0) /1000000))),3) 
            & ',' & RIGHT(TEXT(ROUND(Com[0].PRC_Inventory_Sublimit__c,0)), LEN(TEXT(ROUND(Com[0].PRC_Inventory_Sublimit__c,0))) - LEN(TEXT(FLOOR(ROUND(Com[0].PRC_Inventory_Sublimit__c,0) /1000)))), 
            NULL)))}.
        </html>
    </apex:outputPanel>
    <apex:outputPanel id="IPF" rendered="{!Com[0].PRC_Fee_Invoice_Purchase__c != null}">  
        <html>
            <b>Invoice Purchase Fee:</b> {!Com[0].PRC_Fee_Invoice_Purchase__c}% on the gross amount of all invoices submitted to {!Ld[0].Entity__c} for funding.
        </html>
    </apex:outputPanel>    
    <apex:outputPanel id="IMF" rendered="{!Com[0].PRC_Fee_Inventory_Monitoring__c != null}">  
        <html>
            <b>Inventory Monitoring Fee:</b> {!Com[0].PRC_Fee_Inventory_Monitoring__c}%.<br/><br/>
            <b>Inventory Advance Formula:</b> The lesser of 1) 65% of Net Orderly Liquidation Value as determined by an Inventory Appraiser acceptable) 50% of Eligible A/R and 3) the Inventory Sublimit.
        </html>
    </apex:outputPanel>
    <apex:outputPanel id="FUF" rendered="{!Com[0].PRC_Fee_Funds_Usage_Daily__c != null}">  
        <html>
            <b>Funds Usage Daily Fee:</b> {!Com[0].PRC_Fee_Funds_Usage_Daily__c}%. The Funds Usage Daily Fee shall increase or decrease on the same date as any change in the Prime Rate, by the Prime Rate Adjustment.<br/><br/>
            <b>Prime Rate:</b> The prime rate published by the Wall Street Journal, from time to time as its prime rate.<br/><br/>
            <b>Prime Rate Adjustment:</b> 0.0007% for every 0.25% change in the Prime Rate compared to the existing Prime Rate.
        </html>
    </apex:outputPanel>
    <apex:outputPanel id="ACF" rendered="{!Com[0].PRC_Fee_Aging_Collection__c != null}">  
        <html>
            <b>Aging &amp; Collection Fee:</b> An aging and collection fee of {!Com[0].PRC_Fee_Aging_Collection__c}% of the face value of the purchased invoices for every {!Com[0].PRC_Aging_Collection_Every_X_Days__c} days outstanding beyond {!Com[0].PRC_Aging_Collection_Beyond_X_Days__c} days.
        </html>
    </apex:outputPanel>
    <apex:outputPanel id="FAF" rendered="{!Com[0].PRC_Fee_Field_Appraisal__c != null}">  
        <html>
            <b>Field Appraisal Deposit:</b> ${!IF(Com[0].PRC_Fee_Field_Appraisal__c < 1000, TEXT(ROUND(Com[0].PRC_Fee_Field_Appraisal__c,0)), 
            IF(Com[0].PRC_Fee_Field_Appraisal__c < 1000000, TEXT(FLOOR(ROUND(Com[0].PRC_Fee_Field_Appraisal__c,0) /1000)) 
            & ',' & RIGHT(TEXT(ROUND(Com[0].PRC_Fee_Field_Appraisal__c,0)), LEN(TEXT(ROUND(Com[0].PRC_Fee_Field_Appraisal__c,0))) - LEN(TEXT(FLOOR(ROUND(Com[0].PRC_Fee_Field_Appraisal__c,0) /1000)))), 
            IF(Com[0].PRC_Fee_Field_Appraisal__c < 1000000000, TEXT(FLOOR(ROUND(Com[0].PRC_Fee_Field_Appraisal__c,0) /1000000)) 
            & ',' & MID(TEXT(ROUND(Com[0].PRC_Fee_Field_Appraisal__c,0)), 1 + LEN(TEXT(1 + FLOOR(ROUND(Com[0].PRC_Fee_Field_Appraisal__c,0) /1000000))),3) 
            & ',' & RIGHT(TEXT(ROUND(Com[0].PRC_Fee_Field_Appraisal__c,0)), LEN(TEXT(ROUND(Com[0].PRC_Fee_Field_Appraisal__c,0))) - LEN(TEXT(FLOOR(ROUND(Com[0].PRC_Fee_Field_Appraisal__c,0) /1000)))), 
            NULL)))} paid upon signing of proposal.
        </html>
    </apex:outputPanel>
    <apex:outputPanel id="FEF" rendered="{!Com[0].PRC_Fee_Field_Exam__c != null}">  
        <html>
            <b>Field Exam Deposit:</b> ${!IF(Com[0].PRC_Fee_Field_Exam__c < 1000, TEXT(ROUND(Com[0].PRC_Fee_Field_Exam__c,0)), 
            IF(Com[0].PRC_Fee_Field_Exam__c < 1000000, TEXT(FLOOR(ROUND(Com[0].PRC_Fee_Field_Exam__c,0) /1000)) 
            & ',' & RIGHT(TEXT(ROUND(Com[0].PRC_Fee_Field_Exam__c,0)), LEN(TEXT(ROUND(Com[0].PRC_Fee_Field_Exam__c,0))) - LEN(TEXT(FLOOR(ROUND(Com[0].PRC_Fee_Field_Exam__c,0) /1000)))), 
            IF(Com[0].PRC_Fee_Field_Exam__c < 1000000000, TEXT(FLOOR(ROUND(Com[0].PRC_Fee_Field_Exam__c,0) /1000000)) 
            & ',' & MID(TEXT(ROUND(Com[0].PRC_Fee_Field_Exam__c,0)), 1 + LEN(TEXT(1 + FLOOR(ROUND(Com[0].PRC_Fee_Field_Exam__c,0) /1000000))),3) 
            & ',' & RIGHT(TEXT(ROUND(Com[0].PRC_Fee_Field_Exam__c,0)), LEN(TEXT(ROUND(Com[0].PRC_Fee_Field_Exam__c,0))) - LEN(TEXT(FLOOR(ROUND(Com[0].PRC_Fee_Field_Exam__c,0) /1000)))), 
            NULL)))} paid upon signing of proposal.
        </html>
    </apex:outputPanel>
    <apex:outputPanel id="PF" rendered="{!Com[0].PRC_Fee_Proposal__c != null}">  
        <html>
            <b>Proposal Fee:</b> ${!IF(Com[0].PRC_Fee_Proposal__c < 1000, TEXT(ROUND(Com[0].PRC_Fee_Proposal__c,0)), 
            IF(Com[0].PRC_Fee_Proposal__c < 1000000, TEXT(FLOOR(ROUND(Com[0].PRC_Fee_Proposal__c,0) /1000)) 
            & ',' & RIGHT(TEXT(ROUND(Com[0].PRC_Fee_Proposal__c,0)), LEN(TEXT(ROUND(Com[0].PRC_Fee_Proposal__c,0))) - LEN(TEXT(FLOOR(ROUND(Com[0].PRC_Fee_Proposal__c,0) /1000)))), 
            IF(Com[0].PRC_Fee_Proposal__c < 1000000000, TEXT(FLOOR(ROUND(Com[0].PRC_Fee_Proposal__c,0) /1000000)) 
            & ',' & MID(TEXT(ROUND(Com[0].PRC_Fee_Proposal__c,0)), 1 + LEN(TEXT(1 + FLOOR(ROUND(Com[0].PRC_Fee_Proposal__c,0) /1000000))),3) 
            & ',' & RIGHT(TEXT(ROUND(Com[0].PRC_Fee_Proposal__c,0)), LEN(TEXT(ROUND(Com[0].PRC_Fee_Proposal__c,0))) - LEN(TEXT(FLOOR(ROUND(Com[0].PRC_Fee_Proposal__c,0) /1000)))), 
            NULL)))} paid at close out of initial funding.
        </html>
    </apex:outputPanel>
    <apex:outputPanel id="DDF" rendered="{!Com[0].PRC_Fee_Due_Diligence__c != null}">  
        <html>
            <b>Due Diligence Fee:</b> ${!IF(Com[0].PRC_Fee_Due_Diligence__c < 1000, TEXT(ROUND(Com[0].PRC_Fee_Due_Diligence__c,0)), 
            IF(Com[0].PRC_Fee_Due_Diligence__c < 1000000, TEXT(FLOOR(ROUND(Com[0].PRC_Fee_Due_Diligence__c,0) /1000)) 
            & ',' & RIGHT(TEXT(ROUND(Com[0].PRC_Fee_Due_Diligence__c,0)), LEN(TEXT(ROUND(Com[0].PRC_Fee_Due_Diligence__c,0))) - LEN(TEXT(FLOOR(ROUND(Com[0].PRC_Fee_Due_Diligence__c,0) /1000)))), 
            IF(Com[0].PRC_Fee_Due_Diligence__c < 1000000000, TEXT(FLOOR(ROUND(Com[0].PRC_Fee_Due_Diligence__c,0) /1000000)) 
            & ',' & MID(TEXT(ROUND(Com[0].PRC_Fee_Due_Diligence__c,0)), 1 + LEN(TEXT(1 + FLOOR(ROUND(Com[0].PRC_Fee_Due_Diligence__c,0) /1000000))),3) 
            & ',' & RIGHT(TEXT(ROUND(Com[0].PRC_Fee_Due_Diligence__c,0)), LEN(TEXT(ROUND(Com[0].PRC_Fee_Due_Diligence__c,0))) - LEN(TEXT(FLOOR(ROUND(Com[0].PRC_Fee_Due_Diligence__c,0) /1000)))), 
            NULL)))} paid upon signing of proposal.
        </html>
    </apex:outputPanel>
    <apex:outputPanel id="CT" rendered="{!Com[0].PRC_Special_Pricing__c != null}">  
        <html>
            <b>Custom Terms:</b> {!Com[0].PRC_Special_Pricing__c}
        </html>
    </apex:outputPanel>
    <html>
        <b>Collateral:</b> A first priority, security interest in [Collateral] of Client.<br/><br/>
        
        <b>Lockbox:</b> All payments and other collections of Client’s accounts will be mailed, wired, or sent via ACH by Client’s customers to and administered through {!Ld[0].Entity__c}’s lockbox. All collections received by {!Ld[0].Entity__c} will decrease the amount of Funds Employed.<br/><br/>
        
        <b>Individual Guarantee(s):</b> Guarantees may be required from Client’s owners and shareholders as determined by {!Ld[0].Entity__c}.<br/><br/>
        
        <b>Term:</b> The term of the Facility will be 12 months, with successive 12 month renewals. <br/><br/>
        
        <b>Target Closing Date:</b> By &nbsp;<apex:outputText value="{0,date,MMMM dd, yyyy}"><apex:param value="{!Ld[0].Date_Target_Close__c}" /></apex:outputText>.<br/><br/>
        
        <b>Closing Conditions:</b> [Closing Conditions]<br/><br/>
        
        If the foregoing correctly sets forth your understanding of the proposed financing described herein, please indicate your acceptance of this proposal by signing no later than [Proposal Deadline].<br/><br/>
        
        This proposal does not constitute a commitment from {!Ld[0].Entity__c} or {!Ld[0].Company} to enter into a binding contract to provide financing, nor an undertaking to provide financing, with the express exception of the paragraphs entitled “Fees” and “Expenses”, which the parties intend to become binding at the time that this proposal is accepted.<br/><br/>
        
        Sincerely,<br/><br/>
        
        {{*Sig_es_:signer1:signature}}<br/><br/>
        
        {!us[0].FirstName} {!us[0].LastName}<br/>
    </html>
    <apex:outputPanel id="ent1" rendered="{!Ld[0].Entity__c == 'ent1'}">  
        <html>
            LS DE LLC<br/>
        </html>
    </apex:outputPanel>
    <apex:outputPanel id="ent2" rendered="{!Ld[0].Entity__c == 'ent2'}">  
        <html>
        </html>
    </apex:outputPanel>
    <html>
        {{*Sig_es_:signer2:signature}}
    </html>
<!--Custom creation by Ryan Greene ryan.greene@outlook.com-->
</apex:page>

Apex Controller:
public class ProposalEC {
    //this first section is for the VF page 'Proposal' to pull the needed information from the Lead, Component, and User objects
    //Each List "gets" the records based on the query below , and "sets" the information for use from the VF Page
//Custom creation by Ryan Greene ryan.greene@outlook.com
    public List<Lead> Ld {get;set;}
    public List<Component__c> Com {get;set;}
    public List<User> us {get;set;}
    //gets the Id of the current record
    public Id getid {get;set;}{
        getid = ApexPages.currentPage().getParameters().get('id');}    
    //method to get the proper records and all needed fields for the VF Page
    public ProposalEC(){
        Ld = [SELECT Id, OwnerId, City, State, PostalCode, Street, Entity__c, Date_Target_Close__c, Company,
              FirstName, LastName FROM Lead WHERE Id =: getid];
        Com = [SELECT Id, PRC_Facility_Size__c,PRC_Advance_Rate__c,PRC_Aging_Collection_Every_X_Days__c,PRC_Aging_Collection_Beyond_X_Days__c,PRC_Fee_Aging_Collection__c,PRC_Fee_Funds_Usage_Daily__c,
               PRC_Fee_Inventory_Monitoring__c,PRC_Fee_Invoice_Purchase__c,PRC_Advance_Rate_Inventory__c,PRC_Inventory_Sublimit__c,
               Name,PRC_Fee_Field_Appraisal__c,PRC_Fee_Field_Exam__c,PRC_Fee_Proposal__c,PRC_Fee_Due_Diligence__c,PRC_Special_Pricing__c
               FROM Component__c WHERE RecordTypeId = '0123F0000008XdC' AND Active_Component__c = True AND Related_Lead__c =: Ld[0].Id];
        us = [SELECT FirstName, LastName FROM User WHERE Id =: Ld[0].OwnerId];
    }
    //This section takes the Lead based on variable above 'getid' and creates an Adobe Sign Agreement and PDF based on its information 
    private ApexPages.StandardController standardController;
    public ProposalEC(ApexPages.StandardController standardController){
        this.standardController = standardController;}
    List<Lead> led = [SELECT Id, Name FROM Lead WHERE Id =: getid LIMIT 1];
    
    public pageReference SendPdf2(){
        //Tells the VF Page Proposal where to access the Lead information. Then sets the body of the pdf for later use
        pageReference pdfPage = Page.Proposal;
        pdfPage.getParameters().put('Id',getid);
        blob pdfBody;
        if(Test.isRunningTest()){
            pdfBody = blob.valueOf('Unit.Test');
        }else{
            pdfBody = pdfPage.getContentAsPDF();}
        //Creates the AdobeSign Agreement
        echosign_dev1__SIGN_Agreement__c agreementRec = new echosign_dev1__SIGN_Agreement__c();
        agreementRec.Name                                    = 'Proposal for: '+led[0].Name;
        agreementRec.echosign_dev1__Signaturetype__c         = 'e-Signature';
        agreementRec.echosign_dev1__Recipient_Lead__c        = led[0].Id;
        agreementRec.echosign_dev1__Enable_Hosted_Signing__c = true;
        insert agreementRec;
        //Creates the attachment pdf for the Agreement
        attachment pdfFile = new attachment();
        pdfFile.isPrivate  = false;
        pdfFile.body       = pdfBody;
        pdfFile.parentId   = agreementRec.id;
        pdfFile.Name       = 'Proposal for: '+led[0].Name+'.pdf';
        insert pdfFile;
        //Redirects the user to the Adobe Sign Agreement screen so they can preview and send immediately if needed
        PageReference pageref = new PageReference('/' + agreementRec.id);
        pageref.setRedirect(false);
        return pageref;
    }
}
//Custom creation by Ryan Greene ryan.greene@outlook.com


 
This was selected as the best answer
Milan VadhiaMilan Vadhia
@Ryan, Thank you for such quick comment to help. 
Milan VadhiaMilan Vadhia
What can I do if I don't want to redirect to Adobe Sign EchoSign page from custom visualforce page and directly it should send email for signature by clicking on Send button on visualforce page via adobe sign.

I don't want user to redirect to the Adobe Sign Agreement screen and email should directly send email for signature.
 
Ryan GreeneRyan Greene
Hi Mila
Add the line below where you create the EcoSign Agreement, it will set the Agreement to auto send:
agreementRec.echosign_dev1__Background_Action__c   = 'Send';
You may need to adjust the redirect page if you auto send.
 
Milan VadhiaMilan Vadhia
@Ryan : Thank you
Milan VadhiaMilan Vadhia
Used this line as above did not work in my case:
 
echosign_dev1.EchoSignApiService.sendDocument(agreementRec.Id);
Ryan GreeneRyan Greene
Is that an error you received? I do not see that line in the code above.
Or is that the line you added to make it work?
Milan VadhiaMilan Vadhia
Hi Ryan,

It was not giving any error. But It was not sending email too. So making it work I have added this line and removed line which you provided. May be that line works in asynchronous callout.
Ryan GreeneRyan Greene
You're doing this in the sandbox right? You need to allow emails before it will work. Go to Setup>Email Administration>Deliverability, then under Access Level select All email. By default your Sandbox is set to not allow outbound emails.

User-added image