You are viewing limited content. For full access, please sign in.

Question

Question

Advice on a Solution

asked two days ago

Hi all,

 

I'm trying to create a workflow solution but have run out of ideas. 

Basically I want to be able to send out a Contract for a user to be able to sign. I'm trying to make this as seamless as possible. 

The features I'm trying to achieve are 

1. Trackable with reminders, I thought a forms task was the best way to achieve this.

2. Able to sign in via the form (I've got this part sorted)

3. Able to view the contract they are about to sign.

 

I'm working with pre-created PDF contracts and have been looking at a few ways to tackle this but can't find a 'nice' way of doing it.

 

Solution

I get the mail merge via workflow by looking into a repository folder, go through the pdfs and discover their name and invoke a business process to go to them. This part is fine.

Also I don't have access to Docusign or any apps like that.

Type A

I send them the business process form and embed their contract into the form. My issue is I am trying to embed the document so it just shows the contract, not any buttons or other toolbars which I have scoured this forum and tried various things from the weblinks config to no avail. I have alot of work to do on the repository so the last thing I want is a user wandering around the folders etc.

Type B

I tried copying the contract and pasting it directly into a HTML in the form, this works but I cannot think of a way this could be automated with workflow to Inject the HTML into each form.

Type C

I could attach the contract to an email, but I do not know if I can invoke the business process and give them the link for their task in the same email. I cannot see a way to also embed the contract pdf into the initial Business Process email where it can have the task link.

Type D

I could send an email and pass the business process the variables specific to the user via the URL pass process, however, then I wouldn't be able to track who hasn't returned the form.

Ideally I'd like the user to be able to see the contract and sign it in the one place.

 

Has anyone tackled something similar?

 

Thanks!

 

 

 

0 0

Answer

SELECTED ANSWER
replied one day ago

Hi Shan,

 

You can remove the button that navigates back to the folder by adding &mode=embed at the end of the URL if you are using an iframe with the web client or a weblink in your forms. The only drawback is that if you save the form in Laserfiche with the signature, the iframe will be empty.

 

If you want to compose the contract in HTML, you can use a lookup rule to generate the HTML from a SQL query, or store all the variables as hidden fields in the form and assemble the HTML using a JavaScript script. You can use the rich text field and even embeed the base64 image of the signature field in the HTML generated, then save the forms as a tiff or PDF or merge the rich text content with a word document.

 

The image of the signature in base64 can be retreived by the workflow and can be applied to a PDF via script if needed...

 

On our side, typically, for this type of scenario, we use a two-form process: one form to gather the required information to populate the PDF or Word document, and a second public form for signing. When the first form is submitted, we merge the information into the PDF or Word document. This document can then either be sent as an attachment via a workflow or exported via a script as a PNG file to a folder hosted in IIS to be embedded in the second forms.

 

When sending the email with the link to the signing form, I add URL parameters to the form URL that include the exported file name and a transaction ID that you generate. A script on the form then loads the PNG. When the form is saved, the contract and the signature are captured together in a single save.

 

Sample javascript on the forms

var pdfname = LFForm.getFieldValues({fieldId: 61}); //Field that contains the png file
var html='';


var html = '<img src="https://lasericheserver/Contract/Contract_'+pdfname+'.png" width="100%" height="100%"/>';

LFForm.changeFieldSettings( {fieldId: 59}, 
{content: html} ); //fill the custom html field

Sample CSS

.signature{
   background-color:#FFFFFF !important;
}

sample workflow here I am using a word document and converting it to PDF with the "update word document" but you can also do a PDF merge directly.

Sample script in c#, here we are using PDFiumSharp to export the PDF in png but you could also use the new schedule generate page activity from laserfiche and export the generated page has png.

namespace WorkflowActivity.Scripting.SDKScript3
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Data.SqlClient;
    using System.Text;
    using Laserfiche.RepositoryAccess;
    using Laserfiche.DocumentServices;
    using System.IO;
    using PDFiumSharp;
    using System.Drawing;
    using System.Drawing.Imaging;

    /// <summary>
    /// Provides one or more methods that can be run when the workflow scripting activity is performed.
    /// </summary>
    public class Script1 : RAScriptClass110
    {
        /// <summary>
        /// This method is run when the activity is performed.
        /// </summary>
        protected override void Execute()
        {


            string myUniqueFileName = string.Format(@"{0}", Guid.NewGuid());
            string dPath1 = @"C:\inetpub\wwwroot\Contract\Contract_"+myUniqueFileName+".png";
            WorkflowApi.TrackInformation(myUniqueFileName);

            DocumentExporter de  = new DocumentExporter();
            DocumentInfo di = Document.GetDocumentInfo(Int32.Parse(GetTokenValue("CreateEntry2_OutputEntry_ID").ToString()), RASession);
            WorkflowApi.TrackInformation(GetTokenValue("CreateEntry2_OutputEntry_ID").ToString());

            MemoryStream msIN = new MemoryStream();
            de.ExportElecDoc(di,msIN);
            PdfDocument doc = new PdfDocument(msIN.ToArray()); 
            PDFiumSharp.PdfPage page = doc.Pages[0];
            PDFiumBitmap dbitmap = new PDFiumBitmap(int.Parse(page.Width.ToString())*2,int.Parse(page.Height.ToString())*2, true);
            page.Render(dbitmap);
            MemoryStream msOUT =  new MemoryStream();
            dbitmap.Save(msOUT);
            msOUT.Position=0;
            Bitmap src = new Bitmap(msOUT);
            // Crop for the part of the signature
            int maxHeight = 800;
            Bitmap croppedImage;
            if (src.Height > maxHeight)
            {
                Rectangle cropRect = new Rectangle(0, 0, src.Width, maxHeight);
                croppedImage = src.Clone(cropRect, src.PixelFormat);
                src.Dispose();
            }
            else
            {
                croppedImage = src;
            }

            Bitmap src2 = new Bitmap(croppedImage.Width, croppedImage.Height);
            Graphics g = Graphics.FromImage(src2);
            g.Clear(Color.White);
            g.DrawRectangle(new Pen(new SolidBrush(Color.White)), 0, 0, src2.Width, src2.Height);
            g.DrawImage(croppedImage,0,0, src2.Width, src2.Height);
            src2.Save(dPath1, ImageFormat.Png);

            WorkflowApi.SetActivityTokenValue("DOCNAME",myUniqueFileName);
        }
    }
}

 

I hope that this will be usefull to you.

2 0

Replies

replied one day ago

I would definitely recommend option A. Take a look at the different url parameters that the web client supports https://doc.laserfiche.com/laserfiche.documentation/12/userguide/en-us/content/ref-links-urls.htm

I'm assuming you meant web client when you said weblink because you're assigning tasks to licensed users who should be able to access the repository as well.

I'd definitely try the "mode=embed" option, but the "mode=small" and "mode=phone" provide collapsed left/right panes. There is also "readonly=true" which might hide some of the toolbars.

1 0
replied one day ago

Wow Christmas come early! 

Thanks for the detailed info, this has helped me get to the next step!

I also think I was using multiple attributes which caused the embed mode not to work. 

Thanks for the time to share your info, really appreciated!

Have a great end to the year and a good start to the new one!

 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.