Is it possible to merge word documents

Aug 10, 2011 at 3:50 PM

I'm doing a project at the moment on our intranet (windows server/PHP/mssql) where I need to collate several MS Word/pdf documents into a single document.

e.g. standard front page, custom form, standard final page with custom header & footer (e.g. with patient details on them) on each page.

Can this be done?

I'm thinking that I could create a new document with header & footer, then embed the standard documents as objects, create the custom & spit out as a composite doc. All I need (really) is how to EMBED rather than LINK objects in a new doc.

phpword fully installed & working, etc - I just lack the relevant knowledge of how to use the tool to full effect ;-)

Many thanks in anticipation for any help given!

Aug 11, 2011 at 3:43 PM

It's possible to use ImageMagick and other such apps to convert PDF to an image. An image of the PDF can be then added to your Word doc.

Or perhaps you could create a PDF instead of a Word doc? For creating PDFs, I like tcpdf 

tcpdf does not read PDFs, but I found this page: which has information about an extension for tcpdf that provides a way to read a PDF and then add the contents to a new PDF.


Sep 2, 2011 at 2:22 PM

Thank you for your response.

However, I want to be able to combine 2 word documents and end up with a word document, preserving formatting. The intention is to combine a standard part 1, custom-built (from database elements) part 2 and an optional part 3 and end up with one document with common headers and correct page numbers through the doc.

I want to end up with a word document as this is being used to create a standard document for a research study: one per participant/subject, which can then be updated with the participant's details (to avoid illegible handwriting issues!) and printed out to put in a study file.

Ideas, anyone?
many thanks