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

Question

Question

sdk: How to print a Windows file

asked on September 3, 2018

Hi,

 

Using Workflow and Script SDK, I'm trying to print silently a PDF's file (using the printer).

 

This is my code in C#

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

    /// <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)\\Adobe\\Acrobat 10.0\\Acrobat\\AcroRd32.exe";
    process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
    process.StartInfo.Arguments = string.Format("-p \"C:\\Users\\Olivier\\Desktop\\#012875-LF.pdf\" \"gdn02ptr006\"");
    process.Start();
    process.WaitForExit();
        }
    }
}

 

I don't have error in my workflow but the file didn't print.

 

Need some helps please.

Thanks in advance.

Regards

0 0

Answer

SELECTED ANSWER
replied on September 3, 2018 Show version history

There are 2 things that I think are potentially causing you problems.

The first is that Acrobat does not like to run without a desktop environment so calling it from a service typically does not work.  You should be able to use the Foxit Reader with command line arguments instead of acrobat.

 

The second thing that may cause problems is that the User folders are usually secured so that services do not have access to them and this could cause an issue if the PDF file to print cannot be accessed.  You should try moving the PDF location to something like C:\Temp\#012875-LF.pdf

 

EDIT:

I forgot to mention that if you use Foxit Reader, you need to use version 6.2.3 or below to avoid having the Foxit processes left open due to a security popup that you cannot see when invoked by a service.  Here is the download link for Foxit Reader 6.2.3
http://cdn01.foxitsoftware.com/pub/f..._enu_Setup.exe

1 0

Replies

replied on September 4, 2018

Hi Bert,

Thank you so much, it's working !

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

Sign in to reply to this post.