Use PHP to autofill Word or pdfs

Posted on 2008-11-14
Last Modified: 2012-05-05
I have been given a set of 40+ Word docs that are password protected.  I need to use PHP to fill in the docs.  I can fill PDFs but have been givien protected Word docs with enterable fields.  The final product can be PDF or Word.  I just need to complete a document set and print them after collecting information through a Web interface.
1) Can I programatically fill these forms without having enterable field labels?  
2) Can I convert these to PDFs with tags or do I have to receive the docs unprotected to do this ?

I have a product from Setasign that I have used to complete pdf files with PHP but I've never worked with Word programmatically.  Furthermore, the solution must work on Linux.  I develop on Windows and production is on Linux.

"under the gun"
Question by:V12E
    LVL 76

    Accepted Solution

    The Word document format (.doc) is propriety, so unless you can save the documents in some format other the Word's .doc, i.e. HTML, XML or RTF, and have resource (human or otherwise) for analysing documents so saved, you will need to use the Word Object library to edit them. That means having the Word application installed.

    If PHP can do OLE Automation, and you have Word installed, is should be possible to enter data into the Form Fieds on a document that has that sort of protection.

    Author Closing Comment

    M Word isn't available (to my knowledge) on Linux, I can't rely on having WOrd running for my solution I don't know about the open source Word-like product on Linux

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Suggested Solutions

    This article will show you how to use shortcut menus in the Access run-time environment.
    No matter the version of Windows you are using, you may have some problems with Windows Search running too slow or possibly not running at all. Before jumping into how you can solve this issue, just know there are many other viable alternative deskt…
    Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
    This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now