Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When executing the script via PHP, it doesn't convert #95

Open
ijohnson-TCR opened this issue Jul 31, 2023 · 3 comments
Open

When executing the script via PHP, it doesn't convert #95

ijohnson-TCR opened this issue Jul 31, 2023 · 3 comments

Comments

@ijohnson-TCR
Copy link

With this command:
exec('OfficeToPDF.exe {path}\TEST.docx {path}\TEST.pdf /verbose', $output);
I get this value for $output:

Converting with Word converter
Object reference not set to an instance of an object.
Did not convert

And the file does not convert.

However, when running this command directly from CMD or powershell:
OfficeToPDF.exe {path}\TEST.docx {path}\TEST.pdf /verbose
It works perfectly. What am I doing wrong?

@ijohnson-TCR
Copy link
Author

I would also like to mention, I have added OfficeToPDF.exe to my path, and I've also tried shell_exec() and system() commands which both give the same error.

@norobi
Copy link

norobi commented Oct 2, 2023

Same issue here though I'm trying to use OfficeToPdf on a remote computer using Jenkins.

Works perfectly in local but I have the same error when remoting

@guazontsubasa
Copy link

I think some how you have to run officeToPdf like SYSTEM user.
When you run it from console with your windows user it runs ok, no?
When you run it from the web your System user is running the script.
Try logging the user when you run it:

"Current user: " . get_current_user()

or

"Current user: " . exec('whoami')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants