Convert MS-Office to pdf

2019-09-21 09:38发布

问题:

I'm using OfficeToPDF to convert the MS-Office files to pdf. However, I only can run the command:

OfficeToPDF test.doc test.pdf

in cmd (windows)

I want to embed this code into my cgi file (Perl). Can anyone show me how to do this, thank you!

(I used:

system("OfficeToPDF test.doc test.pdf");

but seems it's not work)

回答1:

That should work but your envormental parameters might not be setup right, you should include full paths(or proper relative ones) and see if that fixes the problem up. If not you might want to post your debug log, or enable verbose output. Your perl also might not be setup to execute shell commands for security reasons when in cgi mode and the logs would help clarify that.



回答2:

Try to:

  • use the full paths to OfficeToPDF and target PDF location because usually, the CGI scripts are run in another user context,
  • check, the CGI user has reading and writing rights for both files (and, off sure, right to execute the OfficeToPDF)

But it depends what means "it's not work", of sure.