Error printing with docPrint on Windows Server 2008 x64 R2

artprint.exe is a desktop application, it need to be run in an INTERACTIVE user account, if you run it from a service, it will not able to access to the desktop, so it may cause the problem.

Also, just a question, how do you use the artprint.exe? can you call doc2pdf.exe from your System Service Application correctly?
Here is a further description of our problems:

- Source code where docPrint_Converter is invoked:

o Importing of docPrintCom.dll:

[DllImport("docPrintCom", CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
private static extern int docPrint_Register(string pOrderID, string pCompanyName);
[DllImport("docPrintCom", CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
private static extern int docPrint_DocumentConverter(string source, string target, string key);

o Invoking the methods:

docPrint_Register("XXXXXXXXXXXXXXXXXXX", "Your Company Name");
docPrint_DocumentConverter(in_FileName, destFileName, "-g 1 -G -e -* XXXXXXXXXXXXXXX");

- Service was tested with [local system account + allow interactive user] and with [Administrator] (could be another user but for testing this account should have all the permissions) account:
o Observations with System account:
* Doc2pdf.exe process is started
* logged in user is prompted to answer a message from a running program
* doc2pdf.exe hangs and with it the service also hangs
* if you click on view the message you get to the “desktop” of  the system account
* Following error message is displayed: "Can’t locate ‘docPrint’ printer on his computer. Would you like to download and install it from our website? Yes/No"
* The System account has print permission for the printer
* Question: How could this problem be solved, so the local system account can find the printer?
o Observations with Administrator account
* doc2pdf.exe process is started by the service
* doc2pdf.exe starts artprint.exe
* artprint.exe seems to fail with following error (from Event Viewer):

Faulting application name: artprint.exe, version:, time stamp: 0x4bfbb333
Faulting module name: KERNELBASE.dll, version: 6.1.7600.16385, time stamp: 0x4a5bdbdf
Exception code: 0xe06d7363
Fault offset: 0x0000b727
Faulting process id: 0x768
Faulting application start time: 0x01cc0002e74359a6
Faulting application path: C:\Program Files (x86)\docPrint Pro v5.0\artprint.exe
Faulting module path: C:\Windows\syswow64\KERNELBASE.dll
* doc2pdf.exe quits and the service continues
* Question: Is this the same problem like with the local system account or something different?
- Another possibility would be to run docPrint itself as service and use RunCmd to send options to the service:
o Problem: With the above dll Import there is no access to the RunCmd method.
i.e. following code is not working ("Unable to find entry point named RunCmd in DLL docPrintCom"):

[DllImport("docPrintCom", CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
private static extern int RunCmd (string cmd, int option);

Please by following solutions to try again,

Solution 1:

Please delete "-e" parameter from your code,

docPrint_Register("XXXXXXXXXXXXX", "Your Company Name");
docPrint_DocumentConverter(in_FileName, destFileName, "-g 1 -G -* XXXXXXXXXXXXX");

Can you work fine with above code witout "-e"  parameter?

If you wish convert MS Office documents to PDF files or other formats from service user account, you need "Configure Office Applications to Run Under the Interactive User Account", please refer to following web page for more information,

Solution 2:

You can call RunCmd method by following solution, RunCmd() method is included in "C:\Program Files\docPrint Pro v5.0\docPrintCom.dll" COM component,

Example 6: Run conversion via "docPrint_Service.exe" application,

Please by following steps to run conversion via "docPrint_Service.exe" application,

1. Please login your server via Remote Desktop under Administrator user account (or other user accounts who own Administrator right),

2. Please run "docPrint_Service.exe" application,

"C:\Program Files\docPrint Pro v5.0\docPrint_Service.exe"

3. Call RunCmd() method to deliver a command line to "docPrint_Service.exe" application,

PHP example,

$com = new COM("DocPrintCom.docPrint");
$com->docPrintCOM_Register("XXXXXXXXXXXXXX"," Inc.");
$com->RunCmd("-i -o C:\\test\\output.pdf -* XXXXXXXXXXXXXX -d -O 2 -s ShowHTMLStatusBar=1 -l 10000", 0);

VB example,

Private Sub Command1_Click()
Set docPrint = CreateObject("DocPrintCom.docPrint")
nRet = docPrint.docPrintCOM_Register("XXXXXXXXXXXXXX", " Company")
nRet = docPrint.RunCmd("-i -o C:\output.pdf -* XXXXXXXXXXXXXX -d -O 2 -s ShowHTMLStatusBar=1 -l 10000", 0)
MsgBox "Return value = " & Str(nRet)
End Sub

4. Close Remote Desktop and leave this user logged in.

*Please Notice: After you reboot the server, you need login your server via Remote Desktop with this user account ("docPrint_Service.exe" was installed inside this user account), and close Remote Desktop, leave this user logged in, when you call RunCmd() function, the conversion will be executed from this user account automatically.

If you still have same problem, please feel free contact us, we will assist you asap.

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

Verify Code   If you cannot see the CheckCode image,please refresh the page again!