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

Question

Question

Workflow Filled PDF Attached to Email Not Encrypting

asked on July 21, 2016

I have a public portal Form taking information in from our client's employees.  This I need to push into an encrypted PDF that is emailed to their relevant supervisor, who then can review and fill out a different Form that's tied back to the original with a unique ID.  

The proof of concept workflow works EXCEPT that there's no encryption when it arrives.  My guess is that it needs to be an LF image file that is created during attachment to add encryption on?  If so, what's the best way to step a filled PDF through that path?  Alternatively, any SDK workarounds?    

 

0 0

Replies

replied on August 18, 2016

In case anyone needs a solution on this, at least until Laserfiche adds an option to encrypt and email the filled PDF itself, I ended up having to export the file to the local server, use a script to pass a .bat file that file location and password (which then calls the .exe file to encrypt the PDF, which was a workaround for the System32 folder's library restrictions), grab the returned encrypted file's location through the .bat, replace the electronic document with the newly encrypted one, and then send that off with the email as an attachment.  A lot of steps to get it done, but it does.  

What it looks like in Workflow:

 

The script (VB):

Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Data.SqlClient
Imports System.Text
Imports Laserfiche.RepositoryAccess
Imports DocumentProcessor100

Namespace WorkflowActivity.Scripting.SDKScriptEncryptFile
    '''<summary>
    '''Provides one or more methods that can be run when the workflow scripting activity is performed.
    '''</summary>
    Public Class Script1
        Inherits RAScriptClass100
        '''<summary>
        '''This method is run when the activity is performed.
        '''</summary>
        Protected Overrides Sub Execute()

        Dim processID As String = ""
        Dim stdOut As String = ""
        Dim exitCode As String = ""
        Using process As System.Diagnostics.Process = New System.Diagnostics.Process

            Try
                Dim SourceFile as String = tokenreplace("%(DownloadElectronicDocument_Result File)")
                SourceFile = SourceFile.Replace(":","")
                SourceFile = "C:\ProgramData\Laserfiche\WF\ServerData\" & SourceFile
                Dim PassCode As String = GetTokenValue("PassCode").ToString
                Dim cmdLineParameters As String = sourcefile & " " & PassCode
                Dim externalProgram As String = "PDFRun.bat"
                Dim waitForExit As Boolean = True
                If (Not String.IsNullOrWhiteSpace(externalProgram)) Then
                    process.StartInfo.UseShellExecute = False
                    process.StartInfo.RedirectStandardOutput = True
                    process.StartInfo.FileName = externalProgram
                    If (Not String.IsNullOrWhiteSpace(cmdLineParameters)) Then
                        process.StartInfo.Arguments = cmdLineParameters
                    End If
                    process.Start()
                    processID = process.Id
                    If (waitForExit) Then
                        Dim output As String = process.StandardOutput.Readline
                        output = process.StandardOutput.ReadLine
                        output = process.StandardOutput.ReadLine  
                        'Iterating to the line I needed.
                        process.WaitForExit()
                        stdOut = output
                        exitCode = process.ExitCode
                    End If

                End If
                Me.SetTokenValue("CmdLine", cmdLineParameters)
                Finally
                    If (Not process Is Nothing) Then
                        process.Dispose()
                    End If
                End Try

            End Using
            Me.SetTokenValue("ProcessID", processID)
            Me.SetTokenValue("FileOut", stdOut)
            Me.SetTokenValue("ExitCode", exitCode)
        End Sub
    End Class
End Namespace

And the script from PDFRun.bat file to work as an intermediary between the executable console app and Workflow:

CALL "C:\PDFEncrypt\PDFEncrypt.exe" %1 %2

 

1 0
replied on July 21, 2016

Yes, the option applies to image pages exported as PDF.

0 0
replied on August 17, 2017

Has Laserfiche looked into adding the functionality of using workflow to Password Protect a fillable PDF form a previous step?

 

Thanks in advance

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

Sign in to reply to this post.