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?
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?
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(); } } }
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?
Two things,
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.
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?
I am also requesting a more updated version to this