

Excel docx converter pdf#
doc to PDF was most of the time quite reliable. docx also tend to be extremely useful for templating where. In general it's very hard to convert the. doc documents tend to be better supported than word 2007's. In my experience so far, conversion with LibreOffice or OpenOffice can't be relied on. Well my 2 cents when it comes to the topic word 2007 docx, word 97-2004 doc, pdf and all other types of MS Office wishing to be "converted from y to z but in real they don't wanna be". OK, that's it! Hopefully this will be useful to someone and save them the difficulties and learning curve I faced. Note that the $directory variable requires no leading forward slash if the file for conversion is within the web root. The 3 variables in the exec() call relate directly to the 3 at the start of the plain text script above. This PHP function is called once the Word / Excel file has been uploaded to the server. use Įxec("/opt/adocpdf ", $output, $return_var) The script will create a PDF version of the document in the same directory as the original.įinally, initiating the conversion of a Word / Excel file from within PHP (I have it within a function that checks if the file we are dealing with is a word / excel document). I have used this for months now and the 5s gap seems to give enough breathing room. The delay ("sleep 5s") is used to ensure that has enough to time to initiate if required. The 3 variables on the first three lines are provided when the script is executed from with a PHP file. This checks that the libraries are running and then calls the PyODConverter script to process the file and output it as a PDF.

Python /home/website/python/DocumentConverter.py /home/website/$directory$filename$extension /home/website/$directory$filename.pdf usr/bin/soffice -headless -accept="socket,host=127.0.0.1,port=8100 urp " -nofirststartwizard & I also created a plain text file above the web root (I named it "adocpdf"), with the following command line instructions in it: directory=$1

I created a directory on the server and placed the PyODConverter python file within it. Now that the server has the capability to handle MS Office files you are able to convert the files by executing command line instructions via PHP.
Excel docx converter install#
I requested my hosting provider to install the open office RPM on my VPS. The first thing that is required is to install on the server. Apologies if I missed any details, it's been a while since I worked on this solution. I found a solution to my issue and after a request, will post it here to help others.
