# Package hyperref Error: Wrong driver option pdftex' when using mk4ht

I am trying to convert TeX, made using moderncv, to .doc format. I am trying to use the following 2 commands

pdflatex filename.tex
mk4ht oolatex filename.tex


But I'm getting the following error

! Package hyperref Error: Wrong driver option pdftex',
(hyperref)                because pdfTeX in PDF mode is not detected.

See the hyperref package documentation for explanation.
Type  H <return>  for immediate help.
...

l.3905 \ProcessKeyvalOptions{Hyp}


How can I fix the problem? If it is not possible is there any alternate way to convert TeX to .doc?

-
Don't put the pdftex option when calling hyperref; it's not necessary even when using pdflatex. –  egreg Oct 29 '11 at 15:53
@egreg: I think moderncv does this itself! –  Martin Scharrer Oct 29 '11 at 15:57
It's a misfeature of the class, then. –  egreg Oct 29 '11 at 16:09

tex4ht uses dvi as the intermediate format (it inserts \specials into the dvi file). Therefore it internally calls latex, not pdflatex.

Since moderncv uses hyperref as pdftex option, you might want to override it in the document, adding before teh4ht run:

\hypersetup{tex4ht}


You can do it automatically using this tex4ht magic that determines whether tex4ht is used:

\ifx\HCode\UnDef\else\hypersetup{tex4ht}\fi

-
Sorry if I sound stupid, but how can I use it? I'm a newbie to latex. I tried copy pasting it in the tex but I'm getting the error ! Undefined control sequence. l.10 \ifx\HCode\UnDef\else\hypersetup {tex4ht}\fi –  bonzi Oct 29 '11 at 21:18
can you please post an example? –  Boris Oct 29 '11 at 22:16
\documentclass[10pt,a4paper]{moderncv} \ifx\HCode\UnDef\else\hypersetup{tex4ht}\fi \moderncvtheme[blue,roman]{classic} \usepackage[utf8]{inputenc} –  bonzi Oct 29 '11 at 22:19
Well, this works for me. I am afraid you need to post a complete example. –  Boris Oct 29 '11 at 23:00
Oh sorry this is when running mk4ht oolatex filename.tex –  bonzi Oct 30 '11 at 7:03

In older versions of moderncv, there is certainly the pdftex option set when requiring (importing) hyperref. It seems to be fixed in the latest distribution; sadly, this doesn't seem to have made its way to OpenSuSE yet.

-