I am converting a .docx, .doc file to .ps file. Work fine on the local machine and prints the .ps file but on IIS 7.5 it doesn’t print, I just get this error
“The ActiveX-Server has not been started! Please use function “cStart()” to start the ActiveX-Server!”
I have tried cStart(“/NoProcessingAtStartup”, false) with no luck and done multiply searches that lead to no resolve. Has anyone run across something like this before?
IIS:
Anonymous Authorization,
Application Pool Identity
PDFCreator.clsPDFCreator creator = new PDFCreator.clsPDFCreator();
PDFCreator.clsPDFCreatorOptions options = new PDFCreator.clsPDFCreatorOptions();
options = creator.cOptions;
PDFCreator.clsPDFCreatorError perr = new PDFCreator.clsPDFCreatorError();
if (!creator.cStart("/NoProcessingAtStartup", false))
{
Console.Write("Can't Initiase PDF Converter, letter Generation Error");
}
options.UseAutosave = 1;
options.UseAutosaveDirectory = 1;
options.AutosaveDirectory = path;
options.AutosaveFilename = name;
options.AutosaveFormat = 6; //0=PDF, 1=PNG, 2=JPG, 3=BMP, 4=PCX, 5=TIFF, 6=PS, 7= EPS, 8=ASCII
creator.cOptions = options;
creator.cSaveOptions();
creator.cClearCache();
creator.cPrinterStop = false;
creator.cDefaultPrinter = "PDFCreator";
creator.cPrintFile(pathFull);
err = creator.cError.Description.ToString();
It is probably because the Application Pool User doesn’t have permission to run PDFCreator or because it’s never run PDFCreator before and on first run it’s trying to do some installation or setup interactively and the Application Pool User doesn’t have an interactive context. Although I would lean towards the latter as I’d expect a different error if it was the former.
If PDFCreator is accessible via the DCOM config section in Computer Management/Component Services then you could try setting it to always run as under a specific user identity, probably your own.
You would also need to give the Application Pool User permission Launch and Activiation and Access permissions on it.
Alternatively you could try impersonation either in your application config or code and impersonate the account you’d normally use with PDFCreator.
Update: Although Word was the actual problem and PDFCreator was trying to activate it, the above suggestions still apply exactly.
If another process is trying to activate Word the user running that process will need to have DCOM permissions on it, and Word will probably need to be run as a specific user if the activating process user doesn’t have permission or has never used it before.
As a specific example, say you’re running the process under the Network Service account and it tries to activate Word, when a new user tries to run Word for the first time Word will throw up some installation windows for first time configuration, but since the user is not interactively logged in these windows cannot be seen and cannot be responded to so the installation hangs. In this case it is better to set Word to always start up under a specific identity in the DCOM config.