Forum


Replies: 1   Views: 966
Docx->pdf conversion using ms word conversion plugin
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by admin  · 03-03-2022 - 17:42

Hello,

The Access is denied error is a generic PHP COM error that appears when PHP COM can't access DCOM due to user missing permissions.

First we recommend testing the script using PHP CLI mode. Please note that to use the conversion plugin based on MS Word, absolute paths and double backslashes must always be used. For example, this is correct (from the example FormatConversion/transformDocument/msword/sample_1.php included in the package):

$docx->transformDocument('C:\\path\\transformDocument_msword_1.docx', 'C:\\path\\transformDocument_msword_1.pdf');

but the following line is not valid because it uses relative paths and single backslashes:

$docx->transformDocument('..\..\transformDocument_msword_1.docx', '..\transformDocument_msword_1.pdf');

After running this script using PHP CLI mode, please test the same using the web browser, checking that the user that is doing the conversion has the correct permissions. The generic steps to setup the correct permissions are the following:

1. In the command line put DCOMCNFG
2. Expand Console Root > Component Service > Computers, right-click on My Computer, And Select Properties
3. In the Tab COM Security > Launch and Activation Permissions Click in Edit Default
4. Add the User (Ex. IIS_IUSRS) or service
5. Check Allow Local Launch and Local Activation

Regards.