Forum


Replies: 11   Views: 4541
Transform.php not working
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 asher  · 10-08-2012 - 07:30

I just purchased the pro version of phpdocx with the conversion plugin.

I am trying to use examples/advanced/Transform.php to test the docx to pdf functionality. The docx file is generated correctly but the pdf file is not. There are no PHP errors logged.

Anyone know what the issue might be?

Thanks

Posted by admin  · 11-04-2013 - 12:13

Hello,

Are you running openoffice in headless mode?

Regards.

Posted by asher  · 11-04-2013 - 12:13

No, all I have done is installed phpdocx and the required php modules on my server. Do I need to install OO too? If so, can you point me towards the documentation that tells me all of the things I need to set up to get phpdocx working.

Thanks

Posted by admin  · 11-04-2013 - 12:13

Hello,

OpenOffice for Linux OS is included in phpdocx pro + plugin and corporate versiones. But you can use any version of OpenOffice.

To run openoffice in headless mode execute this command:

$ lib/openoffice/program/soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard

lib/openoffice/program/soffice is the path to OpenOffice executable.

Regards.

Posted by asher  · 11-04-2013 - 12:13

The above command did not work (Ubuntu 12.04)

lib/openoffice/program/soffice: 99: /var/www/phpdocx/lib/openoffice/program/../basis-link/program/pagein: not found
lib/openoffice/program/soffice: 109: /var/www/phpdocx/lib/openoffice/program/../basis-link/ure-link/bin/javaldx: not found
lib/openoffice/program/soffice: 129: /var/www/phpdocx/lib/openoffice/program/soffice.bin: not found
No command 'urp' found, did you mean:
Command 'arp' from package 'net-tools' (main)
Command 'rup' from package 'rstat-client' (universe)
Command 'unp' from package 'unp' (universe)
urp: command not found
bash: .: -n: invalid option
.: usage: . filename [arguments]


Do you have documentation anywhere that tells me how to set your software up? So far it has been very frustrating not having any guides to go by.

Posted by admin  · 11-04-2013 - 12:13

Hello,

Please download the latest version of phpdocx, that uses a new version of openoffice.
To use plugin conversion you can use any version of openoffice (3.2 or greater): included one in phpdocx package or your custom install (Windows, Mac or Linux). The version included within phpdocx is for 32bits machines, so if you have a 64 bits distro you need to install the ia32 package (ia32-libs).
After you have openoffice installed or copied, init it in headless mode (using a script or a command). Now you can instanciate CreateDocx or TransformDocxAdv classes to do transformations.

The next version of phpdocx will include a more detailed guide about this plugin and several improvements.

Regards.

Posted by complexii  · 11-04-2013 - 12:13

[quote][b]Quote from admin on October 1, 2012, 07:55[/b]

The next version of phpdocx will include a more detailed guide about this plugin and several improvements.

[/quote]

is this now available? we've installed oo 64bit via cpanel rpm. we can get is running using your oo init script. we continue to get errors when trying to run the following code:

[code]
require_once($_SERVER['DOCUMENT_ROOT']."/phpdocx/corp/classes/CreateDocx.inc");

$docx = new CreateDocx();

$docx->enableCompatibilityMode();

$text = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, ' .
'sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut ' .
'enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut' .
'aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit ' .
'in voluptate velit esse cillum dolore eu fugiat nulla pariatur. ' .
'Excepteur sint occaecat cupidatat non proident, sunt in culpa qui ' .
'officia deserunt mollit anim id est laborum.';

$paramsText = array(
'b' => 'single',
'font' => 'Arial'
);

$docx->addText($text, $paramsText);

$docx->createDocx('../word_documents/example_text');
$docx->transformDocx('../word_documents/example_text.docx', '../word_documents/example_text.pdf');
[/code]

here are the errors:


** (OdfConverterTestStatic.exe:25557): CRITICAL **: _wapi_shm_file_open: shared file [/.wapi/shared_data-complexi3.serverphase.com-Linux-i686-312-12-0] open error: No such file or directory

** (OdfConverterTestStatic.exe:25557): CRITICAL **: _wapi_shm_attach: shared file [/.wapi/shared_data-complexi3.serverphase.com-Linux-i686-312-12-0] open error
/home/napkinsc/public_html/phpdocx/corp/classes/../lib/OdfConverter: symbol lookup error: /home/napkinsc/public_html/phpdocx/corp/classes/../lib/OdfConverter: undefined symbol: g_assertion_message_expr
Jan 7, 2013 11:10:15 AM com.artofsolving.jodconverter.openoffice.connection.AbstractOpenOfficeConnection connect
INFO: connected
Jan 7, 2013 11:10:15 AM com.artofsolving.jodconverter.openoffice.connection.AbstractOpenOfficeConnection disposing
INFO: disconnected
Exception in thread "main" java.lang.IllegalArgumentException: inputFile doesn't exist: /tmp/tempOdt_50eb0176ec60b.odt
at com.artofsolving.jodconverter.openoffice.converter.AbstractOpenOfficeDocumentConverter.convert(AbstractOpenOfficeDocumentConverter.java:90)
at com.artofsolving.jodconverter.openoffice.converter.AbstractOpenOfficeDocumentConverter.convert(AbstractOpenOfficeDocumentConverter.java:74)
at com.artofsolving.jodconverter.openoffice.converter.AbstractOpenOfficeDocumentConverter.convert(AbstractOpenOfficeDocumentConverter.java:70)
at com.artofsolving.jodconverter.cli.ConvertDocument.convertOne(ConvertDocument.java:154)
at com.artofsolving.jodconverter.cli.ConvertDocument.main(ConvertDocument.java:133)

Posted by admin  · 11-04-2013 - 12:13

Hello,

Please chech this info:

http://www.phpdocx.com/help/conversion-plugin-docx-to-pdf

It's a guide to solve the most common issues. I recommend you to install a RPM as it's noted in

http://www.phpdocx.com/help/conversion-plugin-docx-to-pdf#14

Regards.

Posted by complexii  · 11-04-2013 - 12:13

thanks for the links, but after doing everything your $docx->transformDocx() object still doesn't work. we're going this direction:

[code]
$docx->createDocx('example_text');
//$docx->transformDocx('example_text.docx', 'example_text.pdf');
$tempDoc = 'example_text.docx';
$docDestination = 'example_text.pdf';
passthru('java -jar ' . dirname(__FILE__) . '/../phpdocx/corp/lib/openoffice/jodconverter-2.2.2/lib/jodconverter-cli-2.2.2.jar '. $tempDoc . ' ' . $docDestination);
[/code]

Posted by admin  · 11-04-2013 - 12:13

Hello,

Please contact us at http://www.phpdocx.com/contact. We need to know if you are running OpenOffice in headless mode in background and other info.

Regards.

Posted by jorgelj  · 05-11-2013 - 11:43

Hello,



To solve this issue you just need to create this empty folder: /.wapi/ . Note that the route may change based on your web server config.



Regards.