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

Question

Question

Using Workflow to Export a file OUT of Laserfiche

asked on November 22, 2017 Show version history

Just a quick question,

 

Is it possible to use Workflow and SDK Scripting activity to export a file out of the repository, into a local directory on a hard drive, and if so, how?

0 0

Answer

SELECTED ANSWER
replied on November 22, 2017 Show version history

The short answer is yes. It depends on what format you want, the format of the source document (i.e., pages vs eDoc), and whether or not the Workflow service account has access to the destination folder, but it is possible and I do exactly that for testing quite often.

As an example, the following code takes a LF document and exports it to a network folder as a PDF.

namespace WorkflowActivity.Scripting.PDFExport
{
    using System;
    using Laserfiche.RepositoryAccess;
    using Laserfiche.DocumentServices;

    public class Script1 : RAScriptClass102
    {
        protected override void Execute()
        {
            // Get and lock source document
            DocumentInfo sDoc = (DocumentInfo)this.BoundEntryInfo;
            sDoc.Lock(LockType.Exclusive);

            DocumentExporter dExp = new DocumentExporter();
            dExp.CompressionQuality = 50;
            dExp.IncludeAnnotations = true;
            dExp.BlackoutRedactions = true;
            dExp.PageFormat = DocumentPageFormat.Jpeg;

            var ExportOptions = PdfExportOptions.RenderAnnotationsAsImage | PdfExportOptions.IncludeText;

            string path = @"\\servername\C$\folder\"; //UNC Path
            string filename = "filename.pdf"; //File name with extension
            
            dExp.ExportPdf(sDoc, sDoc.AllPages, ExportOptions, path + filename);

            // Release source document
            sDoc.Unlock();
            sDoc.Dispose();
        }
    }
}

 

2 0
replied on November 22, 2017

Great,


Thanks for an awesome answer and quick reply! Only question I have, is DocumentServices 10.2 and above? Whenever I try to run mine(Which is 10.0) I get an error of DocumentServices does not exist in the namespace 'Laserfiche'. Is there a quick fix for this or does it have to be upgraded?

0 0
replied on November 22, 2017 Show version history

Two things,

  1. If you're on WF 10.0, Change RAScriptClass102 to RAScriptClass100
  2. Then, in the script editor,
    • Go to the left Pane and expand the References folder
    • If the references are not present, right-click and select "Add Reference"
    • Type "Laserfiche" in the search box to narrow the results
    • Add the necessary reference(s)

 

1 0
replied on November 22, 2017

DocumentServices should match the version of your RepositoryAccess which should match the version of your Workflow Server. Workflow 10.0 would only have 10.0.0.0 for both RepositoryAccess and DocumentServices. 10.2 would have both 10.0.0.0 and 10.2.0.0.

If you're running Workflow 10.2, I wouldn't recommend downgrading the RAScriptClass to 10.0, just select DocumentServices10.2 when you add the reference. If you're running 10.0, then you probably overwrote it when you pasted Jason's script in.

2 0
replied on April 27

Hello All, 

I know this an old post but is there an update to this script for someone using WF Version 11.0.2308.898?

0 0
replied on September 18

I am also requesting a more updated version to this 

0 0

Replies

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

Sign in to reply to this post.