PDF Creator Asp.Net on server

Hi There,

I've an application which requires users to upload a document in .doc or .docx format and I have to convert it to PDF.

In my code - I'm calling an exe which will call pdfcreator.exe with command line arguments.

Code :

var psi = new ProcessStartInfo(System.Configuration.ConfigurationManager.AppSettings["pdfcreator"])
{
Arguments = "/PrintFile="" + path + key + ext + "" /PrinterName="PDFCreator3"",
UseShellExecute = false

        };
        var p=Process.Start(psi);
        p.WaitForExit();

It runs very well on local muchine. But after deploying to server it stucks at some point.

I'm using Open Office as word application.

I'm running this under Administrator account.

Any ideas to help?

thnx

Hi,

are the jobs coming from remote machines on the server and are you using the PDFCreator Server version?
All other PDFCreator versions can usually only handle print jobs coming from the local machine.

Best regards,

Robin

Hi Robin,

We are just triggering pdfcreator from application using Administrator auth.

Our files to convert are located on server.

We are not using PDF creator server version.

We are using PDF Creator 2.3.0

thnx

Hi,

that sounds like it should work, is the printing application installed on the server?
The /printfile parameter will print the file from the associated application.
Maybe it will help to find the problem, if you set the logging level to “trace” in the debug section of the application settings, print something and post the log here or send it to support(at)pdfforge.org and we will gladly have a look at it.

Best regards,

Robin

Hi Robin,

When I start pdfCreator exe using code as shown from my web application - nothing comes up in log file - even I have used debug mode - Trace.

Looking further to the issue I found something as below:

From task manager

PDF Creator starts soffice.exe and it calls soffice.bin

in soffice.bin argument -> “-writer” “-env:OOO_CWD=[path]

If i try to open PDF creator exe from another exe on server [manually - logged in on server] - [path] in OOO_CWD command is correct - which is my local directory in inetpub.

But when PDF Creator is triggered from web application [path] is “C:\Windows\SysWOW64\inetsrv”

It seems that this is the issue preventing my doc file conversation.

Can you please help?

thnx

Hi Robin,

Digging further into the issue - I found that was not an issue - [Path] in soffice.bin.

Please advice.

thnx

Hi,

how does the path variable get populated?
It looks like it is connected to the PATH environment variable settings which are set differntly on your user account and the account the web application is run from. PDFCreator only looks up the command to print the specific file type in the registry and executes that command. If adjusting the PATH environment variable doesn’t help, it might help to modify the print/print to entry for the doc/docx file type to use a hardcoded path.

Best regards,

Robin

Hi Robin,

Can you please advice on PATH variable?

If its a path from my web application

var psi = new ProcessStartInfo(System.Configuration.ConfigurationManager.AppSettings["pdfcreator"])
{
Arguments = "/PrintFile="" + path + key + ext + "" /PrinterName="PDFCreator3"",
UseShellExecute = false

        };

This path is like : c:\inetpub\wwwroot\appname\documents -> which is same for both - web app and console app on server.

If it is a -env:OOO_CWD**[path]**

  • please advice on how to tweak or how set static or how to get it done.

I have also tried to run batch command from my web app - with no luck to succeed.

batch file :

d:
cd
cd pdfcreator
start PDFCreator.exe /PrintFile="C:\inetpub\wwwroot\appname\Documents[docname].doc" /PrinterName="PDFCreator3"
pause

Runs perfectly from server and stuck when batch started from web app with admin rights.

Please advice.

thnx

Hi,

please go to the advanced system settings and check your environment variables.
env:OOO_CWD is an enviroment variable which is used to determine which path open office (or the required component) is located in. Forget what I said about the PATH environment variable I was getting confused by the naming, sorry.

Best regards,

Robin

Hi Robin,

I have checked environment variables - nothing is there for openoffice.

Could it be the issue as stated in microsoft kb 184291 - I am unable paste links here.

Subject line of kb article : COM objects fail to print when called from ASP

Please advice.

thanks for all your help.

Hi,

it looks like it could be related to that, but from your earlier posts it seems ther is an issue with the registered print command and a misterious OOO_CWD variable. I installed OpenOffice (4.1.2) in a virtual machine and check the registry entries for the “print to” commands for .doc files, which is “C:\Program Files (x86)\OpenOffice 4\program\swriter.exe” -pt “%2” “%1” here. To check this, go to HKEY_CLASSES_ROOT.doc\OpenWithProgIDs (which is OpenOffice.Doc here) and then check which command is registered for printing with that ProgId in HKEY_CLASSES_ROOT\OpenOffice.Doc(or whatever ProgID is used on your machine for .doc files)\shell\printto\command.

Best regards,

Robin

Hi Robin,

I've checked registry for openoffice and it is the same as yours.

I've checked event logs and found

Driver PDFCreator required for printer PDFCreator3 is unknown. Contact the administrator to install the driver before you log in again.

I have PDFCreator installed and works very well when executing from server.

Please advice.