27
May
Written by: Jonathan Maron. Stored in: Community, LiveDocx.

Following the server maintenance yesterday, a minor update to the backend service LiveDocx has just been rolled out. phpLiveDocx has been updated correspondingly.

The four changes in LiveDocx 1.1 and phpLiveDocx 1.1-20090527 are:

SSL encryption is mandatory

When SSL encryption was enabled on the LiveDocx server last month, many users wrote us expressing their appreciation. In the following days, we received more e-mail generally saying that SSL should not be an option, but mandatory. Hence, with the goal of assisting PHP users to develop secure applications, all traffic between phpLiveDocx and LiveDocx is now encrypted using SSL. SSL can no longer be deactivated.

PDF files are much smaller

Many users expressed concern about the size of PDF files, produced by phpLiveDocx. The root of this problem could be traced back to a specific PDF export filter used by the underlying technology, which powers LiveDocx. In the meantime, this issue has been fixed and the produced PDF files are now much smaller.

New merge fields are available

The backend service LiveDocx runs on a technology called TX Text Control. Recently, TX Text Control 15.0 was released, which now supports a number of new merge field types. These merge fields (listed below) are now available in LiveDocx:

  • MERGEFIELD
  • DATE
  • IF
  • INCLUDETEXT

Additionally, a new merge field is populated automatically at the end of the merge process. It contains the total number of pages in the resulting document.

  • NUMPAGES

I will post some examples, which use these new merge fields in the coming days.

Unit tests with PHPUnit

To ensure the high quality of phpLiveDocx remains thought the current and all future versions, full unit testing has been added. Take a look at the directory phplivedocx/tests in the downloadable distribution file. To start the tests, ensure you have PHPUnit installed (via PEAR) and run phplivedocx/run-tests.sh. The unit tests are written against PHPUnit 3.3.16.

Update now

The latest version of phpLiveDocx is a drop in replacement for the old version. Only in the case that you explicitly turned off SSL encryption in the constructor, do you need to delete the third parameter of the constructor. Remember: SSL encryption is now mandatory!

Download phpLiveDocx.

Bookmark and Share
26
May
Written by: Jonathan Maron. Stored in: LiveDocx.

The backend server that powers phpLiveDocx - LiveDocx Service - will temporarily shut down this morning between 09:00 and 10:00 GMT for some essential maintenance. During this period, LiveDocx Service will not be available.

The LiveDocx Service engineers apologize in advance from any inconvenience that this may cause.

Please refer to the original blog post in the LiveDocx Blog.

Bookmark and Share
15
May
Written by: Jonathan Maron. Stored in: Samples.

In a typical office environment word processing documents are received via e-mail in a number of different formats. This phpLiveDocx sample application illustrates how to automatically convert files between any supported format (see below).

All end-users have to do, is copy the documents they wish to convert into a specific network directory (aka Hot Folder) and the files are converted in a matter of minutes into the desired format. End-users can than pick up the converted documents and process them further, send them via e-mail or to the printer.

Consider the following screenshot of a typical Windows desktop (click to enlarge). The top window is the directory, which contains the files to convert. Once they have been converted the files are moved into the middle directory. The actual converted files are saved in the bottom window.

Supported file formats

The following input file formats are supported:

  • DOCX - Microsoft Word DOCX Format
  • DOC - Microsoft Word DOC Format
  • RTF - Rich Text File Format
  • TXD - TX Text Control Format

The following output file formats are supported:

  • DOCX - Microsoft Word DOCX Format
  • DOC - Microsoft Word DOC Format
  • RTF - Rich Text File Format
  • PDF - Acrobat Portable Document Format
  • TXD - TX Text Control Format
  • TXT - ANSI Plain Text

Getting started

Download the current phpLiveDocx distribution file and unzip or untar the archive to your local file system. This sample application is contained in the phplivedocx/samples/mail-merge/convert-batch/ directory. If you are using phpLiveDocx for the first time, please review the Getting Started Guide.

Copy the files you want to convert into the directory queue. For your convenience, there is already a number of demonstration files in this directory.

Run the run-job.php script with the file format into which you wish to convert your documents. For example:

./run-job.php --output-format pdf

And sit back! phpLiveDocx will convert your documents.

The converted documents (i.e. the PDF versions in the above example) will be placed in the directory output.

The original document will be moved to the directory queue_done.

To get a list of supported output file formats from the command line, simply call run-job.php with no parameters:

./run-job.php

Automation with cron

If you are running Linux on your server, you can call the run-job.php script every n minutes to fully automate the task of converting documents.

If you set it up like this, all you have to do is copy the files you want to convert into the queue directory and wait for a maximum of n minutes.

Once the next cron job has been called, the documents will be converted into the desired format in the output directory.

To do this, fire up your crontab editor:

crontab -e

And add the following line to call run-job.php every 5 minutes:

*/5 * * * * cd [PATH]/phplivedocx/samples/mail-merge/convert-batch && ./run-job.php --output-format pdf | mail -a "From: [FROM_EMAIL]" -s "phpLiveDocx Batch Converter" [TO_EMAIL]

Replacing the placeholders (strings between [ and ]) with…

  1. [PATH] with the path to the phpLiveDocx sample application.
  2. [FROM_EMAIL] with the e-mail FROM which the cron job confirmation should be sent.
  3. [TO_EMAIL] with the e-mail TO which the cron job confirmation should be sent.

cron will then execute run-job.php every five minutes and in addition sent you an e-mail report of the batch convert job to the specified e-mail address.

The final step to allow the situation, as shown in the above screenshot, is to share the three directories queue, queue_done and output with Windows clients. This can be done via Samba or any other network file system supported by Windows and/or Mac. Once the shares are in place, shortcuts to the appropriate network directories can be added to the desktop (illustrated in the right half of the screenshot).

Need help?

If you need help, please post your questions and/or comments below or in the support forum and I will assist as much as I can.

Bookmark and Share