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

Question

Question

Is there an activity to use in a workflow to print an image

asked on September 18, 2018

I have a file on another server that contains Laserfiche Entry ID's.  I need to run a workflow once a day to read that file and for each Entry ID, print the associated document.  Is there an activity in workflow that will do that or is there a way to create a custom activity to do it?  

0 0

Replies

replied on September 18, 2018

See this related thread.  In general, applications don't support printing from a service environment, but if you have a narrow set of document types or a specific application that does support it, it's not too hard to put a custom script together.

0 0
replied on September 18, 2018

Hi  John,

 

In my mind, you should create a custom activity using SDK.

I created mine to print a PDF outside from Laserfiche (idk how to do to print a PDF from Laserfiche).

So first, I execute a workflow to export un doc from Laserfiche to Windows then, I'm using my script to print this file and at the end to delete this file from Windows. The processus is a little be "strange", but it's working XD

 

This is my SDK for export (C#)

My token "NomFichier" = Windows' Path (Exemple : "C:\\ForPrint\\Print-OI-Admin.pdf")

namespace WorkflowActivity.Scripting.ExportPDF
{
    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;

    /// <summary>
    /// Offre une ou plusieurs méthodes qui peuvent être exécutées au moment de l'exécution de l'activité de scriptage du flux de travail.
    /// </summary>
    public class Script1 : RAScriptClass102
    {
        /// <summary>
        /// Cette méthode est exécutée quand l'activité est effectuée.
        /// </summary>
        protected override void Execute()
        {
            // Rédigez votre code ici. La propriété BoundEntryInfo accèdera à l'entrée, RASession obtiendra la section de Repository Access
            Laserfiche.DocumentServices.DocumentExporter DocEx = new Laserfiche.DocumentServices.DocumentExporter();
            DocumentInfo DI = Document.GetDocumentInfo(this.BoundEntryId, RASession);
            DocEx.ExportElecDoc(DI, Convert.ToString(GetTokenValue("NomFichier")));

        }
    }
}

Then,

My script to print

namespace WorkflowActivity.Scripting.Print
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Data.SqlClient;
    using System.Text;
    using Laserfiche.RepositoryAccess;
    using System.Diagnostics;

    //Pour impression
    using System.IO;

    /// <summary>
    /// Offre une ou plusieurs méthodes qui peuvent être exécutées au moment de l'exécution de l'activité de scriptage du flux de travail.
    /// </summary>
    public class Script1 : RAScriptClass102
    {
        /// <summary>
        /// Cette méthode est exécutée quand l'activité est effectuée.
        /// </summary>
        protected override void Execute()
        {
            // Rédigez votre code ici. La propriété BoundEntryInfo accèdera à l'entrée, RASession obtiendra la section de Repository Access
            Process process = new Process();
    process.StartInfo.FileName = "C:\\Program Files (x86)\\Foxit Software\\Foxit Reader\\Foxit Reader.exe";
    process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
    process.StartInfo.Arguments = string.Format("-p \"" + GetTokenValue("NomFichier") + "\" \"gdn02ptr006\"");
    process.Start();
    process.WaitForExit();


            //DEBUT Suppression du fichier imprimé
            if(File.Exists(@"C:\ForPrint\Print-OI-Admin.pdf"))
                {
                    File.Delete(@"C:\ForPrint\Print-OI-Admin.pdf");
                }
            //FIN Suppression du fichier imprimé

        }
    }
}

Oh yes, I forgot, you need to install Foxit Reader in your server for use this script.

 

Hope this could help.

 

Regards

0 0
replied on September 18, 2018

I really appreciate the help.  I'm going to try these suggestion and see what happens.  I'm open to all suggestions since I am fairly new to Laserfiche.

 

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

Sign in to reply to this post.