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

Question

Question

Error generating pages in sdk script

asked on June 4, 2019

Hi all.

I have the following question.

I have a workflow, with an activity of "sdk script", this is for generating pages to a document, however occasionally I am presenting the following error:

 

"timeout waiting for client startup"

 

The code is the following:

 

namespace WorkflowActivity.Scripting.ConvierteapáginasLF
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Data.SqlClient;
    using System.Text;
    using Laserfiche.RepositoryAccess;
    using Laserfiche.ClientAutomation;
    using System.Linq;
    public class Script1 : ScriptClass90
    {
        protected override void Execute()
        {
           using (ClientManager lfclient = new ClientManager())
           {

                string servidor = "XXXXXXXXX";
                string repositorio = "XXXXXXXXX";
                string usuario = "XXXXXX";
                string password = "XXXXXX";
                int id_DOcumento = Convert.ToInt32(this.GetTokenValue("BuscaDocumento_FirstResult_ID").ToString());

                LaunchOptions options = new LaunchOptions();
                options.ServerName = servidor;
                options.RepositoryName = repositorio;
                options.UserName = usuario;
                options.Password = password;
                options.HiddenWindow = true;
                lfclient.LaunchClient(options);


                System.Collections.Generic.List<ClientWindow> OpenFolderBrowsers = lfclient.GetAllClientWindows(ClientWindowType.Main).ToList();
                this.SetTokenValue("Contador", OpenFolderBrowsers.Count);


                MsgBox(OpenFolderBrowsers.Count+"");
                MainWindow FolderBrowser = OpenFolderBrowsers[0] as MainWindow;
                GeneratePagesOptions Options = new GeneratePagesOptions();
                Options.ShowUI = true;
                System.Collections.Generic.List<int> doc = new List<int>();

                doc.Add(id_DOcumento);
                FolderBrowser.GeneratePages(doc, Options);

           }



        }
    }
}

 

What could be the possible error?

0 0

Replies

replied on June 4, 2019

This has been discussed before in this forum, it's not a supported setup. ClientAutomationTools needs to launch the Client and there is no user session to launch a window in when you're running this script on the Workflow Server.

3 0
replied on June 5, 2019 Show version history

I understand Miruna, now I have two doubts

1: Why does the sdk script work on some occasions and not on others?

2: Do you know how I can generate pages to a document in workflow without using the sdk script?

 

thanks for your help

0 0
replied on June 10, 2019

Workflow does not currently have a way to generate pages from PDFs. You can try finding a library that does that and use it in either scripts or a custom activity.

0 0
replied on June 11, 2019

Dear Miruna,

 

Can you guide us to find a solution or a workaround for this issue ? We need to automate the "generate pages" feature from Laserfiche Forms or Workflow.

 

Thanks.

0 0
replied on June 11, 2019

I use an application called 2tiff which allows me to convert PDFs to Tiff via command line. If you install LibreOffice you can also convert office type documents. I've tested with docx, works great. I did have to tell 2tiff.com staff what my intent was and they gave me the proper keycode to run the application in the system context.

To generate pages in workflow, I run a SDK script to export the document from Laserfiche to a folder path on the hard drive, execute 2tiff to convert, re-import, then clean up the exported and converted files. The solution works really well.  I attempted this with GhostScript before, but would get errors on certain PDFs during import. 

I wish we could have done this using a PDF library and avoided having to export to the file system and run an external application, but all the libraries I found were very expensive. 

2 0
replied on April 29, 2020 Show version history

Hi Jonathan - On the 2tiff site they mostly list older versions of Office, and older operating systems.  Have you had any trouble with Office 2016 or 2019, and does it run on Server 2019 and 2019?

 

Follow Up; The company got back to me -

" Yes, newest version of 2TIFF software is able to convert Microsoft Office 2016 and 2019 files if Microsoft Office is installed on your computer. "

and it runs on Windows server.

0 0
replied on May 20, 2020

We don't have licensing to run Office on Windows Server so we installed LibreOffice and it works to convert those files with 2Tiff. I'm looking at a fairly inexpensive C# library to do it all in memory without having to have LibreOffice installed. https://www.gemboxsoftware.com/document Haven't had time to implement it yet though.

1 0
replied on May 21, 2020

Great tips, both for Libre and Gem. I'll check it out. thanks!

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

Sign in to reply to this post.