Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
I am trying to convert a doc file to pdf with imagemagick.
The debug log shows that the doc file is successfully converted to pdf, but while moving it, it tries to find a doc that doesn't exists. Eg;
"soffice" --headless --convert-to pdf --outdir `dirname "apple.doc"` "apple.doc"
2> "/tmp/magick-27774N2VanFQ6A6bn"; mv "apple.doc.pdf" "/tmp/magick-27774IwoX-tNyM0gj"
convert apple.doc -> apple.pdf using writer_pdf_Export
Overwriting: apple.pdf
mv: cannot stat ‘apple.doc.pdf’: No such file or directory
The above log is slightly modified. My question is why is it trying to move apple.doc.pdf instead of apple.pdf?
Your code options order looks a bit of a mess. I would start with something simple for instance compositing the two images and then build in the rest of your code. This would prove that part works as you have so many parts where it can go wrong.
Bonzo is correct. Just try converting the apple.doc to pdf. See if that works.
I see a couple of possible issues with your command.
First, you may need to use parenthesis about the logo.png and annotate to isolate it to just the logo. Your code may be trying to process both images with the annotate. See http://www.imagemagick.org/Usage/basics/#parenthesis
Perhaps the OP wants to multiply logo.png with each image from apple.doc. If so, a "NULL:" is needed between them. I don't know what should be annotated.
In any case, I agree with Bonzo and Fred. Break down the problem into sub-problems, as as simple as possible, each one a "convert" command. Debug each one. Then, when it all works, optimise by combining the commands.
Good point snibgo. I was assuming he had one single page doc file and one logo. But I think you are probably right in that he wants to watermark each page of the doc file with the logo. -layers composite is then correct, but I do not think you can do -compose with that. But a NULL: is definitely needed between the two images when using -layers composite. If the user wants a less pronounce watermark that and overlay, then he should modify the logo's transparency.
The above code works well while converting pdf to watermarked pdf.
I am trying to convert doc file to watermarked pdf. And it gave that error. Why is it trying to find the apple.doc.pdf instead of converted apple.pdf?
The apple.pdf is actually created. Just gives the above mentioned error
convert -verbose aaaaa.doc outputsss.pdf
"soffice" --headless --convert-to pdf --outdir `dirname "aaaaa.doc"` "aaaaa.doc" 2> "/tmp/magick-13123jDqOlCXpGDh8"; mv "aaaaa.doc.pdf" "/tmp/magick-13123_Eb6RP3Vcg46"
convert /home/suman/aaaaa.doc -> /home/suman//aaaaa.pdf using writer_pdf_Export
mv: cannot stat ‘aaaaa.doc.pdf’: No such file or directory
convert: delegate failed `"soffice" --headless --convert-to pdf --outdir `dirname "%i"` "%i" 2> "%Z"; mv "%i.pdf" "%o"' @ error/delegate.c/InvokeDelegate/1333.
convert: unable to open image `/tmp/magick-13123gXfKk44RNnuB': No such file or directory @ error/blob.c/OpenBlob/2702.
convert: unable to open file `/tmp/magick-13123gXfKk44RNnuB': No such file or directory @ error/constitute.c/ReadImage/540.
convert: no images defined `outputsss.pdf' @ error/convert.c/ConvertImageCommand/3252.
We have been unsure of your purpose. Are you trying to convert a single page doc or a multipage doc? If the latter, are you trying to add the logo to each page or just one page? If you are trying to watermark each page, then you need a NULL: between the doc image and the logo image.
You may be getting one error message that is confusing, if IM detects a different issue such as a missing NULL: when using -layers composite.
Please try what we have suggested above or give us more information about your goals and data.
"soffice" --headless --convert-to pdf --outdir `dirname "aaaaa.doc"` "aaaaa.doc" 2> "/tmp/magick-13123jDqOlCXpGDh8"; mv "aaaaa.doc.pdf" "/tmp/magick-13123_Eb6RP3Vcg46"
convert /home/suman/aaaaa.doc -> /home/suman//aaaaa.pdf using writer_pdf_Export
mv: cannot stat ‘aaaaa.doc.pdf’: No such file or directory
convert: delegate failed `"soffice" --headless --convert-to pdf --outdir `dirname "%i"` "%i" 2> "%Z"; mv "%i.pdf" "%o"' @ error/delegate.c/InvokeDelegate/1333.
convert: unable to open image `/tmp/magick-13123gXfKk44RNnuB': No such file or directory @ error/blob.c/OpenBlob/2702.
convert: unable to open file `/tmp/magick-13123gXfKk44RNnuB': No such file or directory @ error/constitute.c/ReadImage/540.
convert: no images defined `outputsss.pdf' @ error/convert.c/ConvertImageCommand/3252.
Should work fine if you have the correct delegate program and the delegates.xml file points to the location of that delegate. Do you have Soffice in your delegates.xml file and is it pointing to the correct location for that file. If not, the put the full path to that delegate and make sure you have a current version of it on your system. Perhaps your should post a link to your aaaaa.doc file so one of the Windows users can test with it.
Should work fine if you have the correct delegate program and the delegates.xml file points to the location of that delegate. Do you have Soffice in your delegates.xml file and is it pointing to the correct location for that file. If not, the put the full path to that delegate and make sure you have a current version of it on your system. Perhaps your should post a link to your aaaaa.doc file so one of the Windows users can test with it.