I want to convert .DOC files into .PDF format using php image library imagemagick . When I used

convert filename.doc filename.pdf

command in terminal to convert file to .PDF format I got the error

convert: no decode delegate for this image format `ATTENDANCE.doc' @ error/constitute.c/ReadImage/532.
convert: missing an image filename `ATTENDANCE.pdf' @ error/convert.c/ConvertImageCommand/3011.

Any help and suggestions will be appreciable.

  • 1
    .doc files aren't images. You should try seeing if you can automate LibreOffice Writer or Abiword or something in order to print the documents to PDF. – Broam Aug 2 '12 at 15:53

ImageMagick can't read doc files.

You could try

oowriter -pt pdf your_word_file.doc

which requires you have the libre/openoffice suite installed. Note if you have libreoffice, replace oowriter with lowriter.

See this other answer for a similar question.

According to Broam an alternative invocation is

oowriter -convert-to pdf:writer_pdf_Export doc_file.doc –

though I haven't tested this.

Web service

Alternatively I would also suggest using Google docs (now integrated into Google drive) as an alternative if you have a Google account or don't mind making one.

You can upload the doc and it will convert it to pdf for you (or an openoffice format if you prefer).

Which one should you use?

Of these two options, the last time I checked Google docs had a higher conversion fidelity.

  • 1
    About what I was going to say - automate oowriter to do it. :) – Broam Aug 2 '12 at 15:53
  • 1
    The magic seems to be oowriter -convert-to pdf:writer_pdf_Export doc_file.doc – Broam Aug 2 '12 at 15:54
  • lowriter --convert-to pdf YourDoc.doc worked for me( single case of this askubuntu.com/questions/113772/…) – Carmine Mar 12 '19 at 11:23

You can use Libreoffice as a headless tool to convert docs to pdf:

libreoffice --headless --convert-to pdf *.doc

(Taken from this SO answer)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.