how to convert rtf to image format ( jpg/png..)
Asked Answered
W

3

1

i need to convert rtf document that contains images (jpgs/pngs ) to image format jpgs or pngs programmaticly , do you have any ideas on how to do it ? on server side (web) Thanks

Warrantor answered 23/10, 2009 at 5:1 Comment(0)
M
0

You can use a virtual printing device, for example: http://www.joyprinter.com/

Mesoglea answered 23/10, 2009 at 5:6 Comment(0)
P
0

If by programmatically, you mean scripts, you could script your RTF program to open files, then export to PDF, then export the PDF to an image. At least, this kind of operation is relatively easy on OS X. You could probably do it entirely in Automator, using TextEdit and Preview. Otherwise, on OS X you could also try accessing the core services that would do the same thing. No clue on Windows though. Hope that helps!

Picky answered 23/10, 2009 at 6:7 Comment(0)
C
0

You might want to write a bash script to be executed by a cronjob. So at a defined time, or after a defined period, you will have your rtf files converted into jpgs.

Though I don't know if this might satisfy your "programmatic" need .. here is how to do this conversion:

To convert rtf files contain "advanced" features like images, as in your case, you need unoconv, which requires libreoffice to be installed.

unoconv -f pdf "${input_file}"

Otherwise, just for reference because it's not your case, if the rtf files contain only simply text you can avoid the requirement to have libreoffice installed by using a cascade conversion like

// convert rtf to txt
unrtf --text "input_file.rtf" > "temp.txt"

// convert txt to pdf
enscript "temp.txt" -o - | ps2pdf - "temp.pdf"

// convert pdf to jpg
convert -quality 100 -append "temp.pdf" "output.jpg"

// remove temp files
trash "temp.txt" "temp.pdf" // or rm if you prefer
Cornerwise answered 12/2, 2012 at 13:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.