1

I have a perl program hosted on a windows 7, which is being called by a publishing framework hosted on a linux environment.

This publishing framework has a Java based interface which calls the configured script (perl program calling external officetoPDF) on windows to perform the command-line conversion.

Input files (MS Office files) are copied into windows via an FTP (IIS) for OfficeToPDF.exe to convert to PDF.

When executed locally on windows command line works fine with file converted to PDF.

When invoked through publishing framework,officetopdf returns below message

Object reference not set to an instance of an object. Did not convert

I have another external program call for non-office ASCII file to binary file conversion inside my perl program which works perfectly fine with publishing framework call.

I have checked the user permission,execute permission on the ms-office file before conversion and path,still not able to get around this issue.

I also tried permission with related workaround with no luck

Have also come across similar issue reported but not answered in this forum

Any pointer much appreciated

Community
  • 1
  • 1
Ranjan
  • 11
  • 2

2 Answers2

1

You need to set ms word to execute as a specific user. To do that, use the DCOMCNFG tool: Start > run DCOMCNFG

Then expand: Console Root > Component Services > Computers > My COmputer > DCOM COnfig > Microsoft Office Word 97 - 2003 Document

Right click then properties then Identity tab and chose: This user. and set it as an admin user.

That worked for me after trying a number of other options.

In my case I was not using perl but using a scheduled task to run a bat file launching a batch process to convert doc* files to pdf using OfficetoPDF. (https://github.com/cognidox/OfficeToPDF) Great tool by the way

Setting the scheduled task to run as a specific user (admin user in my case) was not enough to get around it and the scheduled task was hanging with winword.exe stuck at 99% cpu. But running the bat file directly would work.

user681365
  • 333
  • 4
  • 9
0

Just to confirm user681365's answer. Doing as they suggest with dcomcnfg AND ALSO running your scheduled task or service as the user specified in the configuration with dcomcnfg did the trick for me.