Lectrician
Technical User
I have a script which executes a doc to pdf conversion on my windows server. I originally used a command line switch on Open Office to do the conversion, and this worked, but the PDF created is poor.
I am now using word and OfficeToPDF.exe.
The command required (that works perfectly on the command line) is d:\officetopdf\officetopdf.exe /print d:\test.docx d:\test.pdf
This creates the PDF perfectly.
Trying to execute this is perl, and I run into trouble.
This executes and returns no error, but I have no arguments.
$cmd = "d:\\officetopdf\\officetopdf.exe /print";
`$cmd`;
This wont execute and returns an error of 256 in $?.
$cmd = "d:\\officetopdf\\officetopdf.exe /print d:\\officetopdf\\a.docx d:\\officetopdf\\a.pdf";
`$cmd`;
I have tried all sorts to get this going, and am just not succeeding.
I have tried just file names with no path. If I print $cmd to screen, copy and paste the line, and then paste it into the command prompt, it executes, so the double \\ are doing their job and escaping the 'true' one.
Any ideas?
Thanks.
I am now using word and OfficeToPDF.exe.
The command required (that works perfectly on the command line) is d:\officetopdf\officetopdf.exe /print d:\test.docx d:\test.pdf
This creates the PDF perfectly.
Trying to execute this is perl, and I run into trouble.
This executes and returns no error, but I have no arguments.
$cmd = "d:\\officetopdf\\officetopdf.exe /print";
`$cmd`;
This wont execute and returns an error of 256 in $?.
$cmd = "d:\\officetopdf\\officetopdf.exe /print d:\\officetopdf\\a.docx d:\\officetopdf\\a.pdf";
`$cmd`;
I have tried all sorts to get this going, and am just not succeeding.
I have tried just file names with no path. If I print $cmd to screen, copy and paste the line, and then paste it into the command prompt, it executes, so the double \\ are doing their job and escaping the 'true' one.
Any ideas?
Thanks.