2004-08-07 13:41
Saturday, August 7th, 2004I felt too lazy last night to blog…
Yesterday through the day I had a funny task – a script to convert html to tiff, which was needed by a friend. It turned out to be really interesting, especially because it needed to have working cyrillic :) Because someone else might need it, here it is:
#!/bin/sh # by#requirements in debian packages: # apt-get install htmldoc xpdf-reader imagemagick gs-common libtiff-tools if [ -z "$2" ]; then echo Usage: $0 input-file output-file-prefix exit 2 fi k=`tempfile` rm -f $k && mkdir $k || exit 8 htmldoc --webpage --continuous $1 -t ps --charset cp-1251 -f $k/OUTPUT.ps cdr=`pwd` cd $k || exit 4 ps2pdf OUTPUT.ps pdftoppm OUTPUT.pdf output convert output*ppm $cdr/$2.tiff cd $cdr || exit 5 rm -rf -- $k
It could probably be written better, especially the thing with that temporary directory, but it’s just a proof-of-concept. The conversion fom postscript to PDF is needed, because htmldoc has a bug in the pdf files generation, and convert doesn’t handle pdf well, and I have to go through ppm. It was a lot of tweaking, until it worked.
Nothing else interesting, except going again at the square to listen to the concerts, and reading Quicksilver. This time they played concert for piano and orchestra number I-can’t-remember-which by Tchaykovski, it was great (on the piano there was Evgeny Kissin, who then has been 15 years old …:) )
I’m having weird dreams, with some known female friends, really weird, second night in a row… Looks like Velin has such too, and I think that probably the apartment is cursed…