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

Question

Question

How I print automatically a LFDocument of the Repository?

asked on February 22, 2019 Show version history

I write this code:

static void Main(string[] args)
        {           

            int documentid = some entry id;
            using (ClientManager lfclient = new ClientManager())
            {
                PrintOptions printoptions = new PrintOptions();
                Laserfiche.ClientAutomation.PageSet pages = new Laserfiche.ClientAutomation.PageSet();
                printoptions.PageNumbers = pages;
                printoptions.DoNotPrompt = true;                               
                printoptions.DocumentPart = PrintType.Images;                

                LaunchOptions launchOptions = new LaunchOptions();
                launchOptions.ServerName = "ServerName";
                launchOptions.RepositoryName = "RepositoryName"; 
                launchOptions.UserName = "userName";
                launchOptions.Password = "password";
                

                ClientInstance singleLf;

 //ClientInstance client = lfclient.LaunchClient(launchOptions);
                //int pid = client.ProcessID;

                MainWindow mainwindow = null;

                //IEnumerable<ClientWindow> windows = client.GetAllClientWindows();
                //foreach (ClientWindow window in windows)
                //{
                //    if (window.GetWindowType() == ClientWindowType.Main)
                //    {
                //        mainwindow = (MainWindow)window;
                //        break;
                //    }
                //}

                singleLf = lfclient.LogIn(launchOptions, out mainwindow);
                mainwindow.PrintById(documentid, printoptions); 
                
                
            }
        }    

My problem is ar this line: printoptions.DoNotPrompt = true;

When I change this to printoptions.DoNotPrompt = false; the program work and print the document, but when I try to change true this error apper:

If I let with false the window where you select your print and other options appers. I need to print directly. Please tell me where I have the error in the code when I change that line with true.

0 0

Answer

SELECTED ANSWER
replied on February 22, 2019

Try providing a printer name in the printOptions object. The LF client crashes if no printer is specified, I filed bug# 156650 to get this fixed.

0 0
replied on February 25, 2019

Thanks. It work for me.

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.