Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Using htlatex to convert LaTeX to HTML

Referring to the question posted above.

So I used both the script and the htlatex command from the command-prompt in order to convert my LaTeX file to HTML but both are giving me errors.

Error with the htlatex command (without script):

*! Package pdftex.def Error: PDF mode expected, but DVI mode detected! (pdftex.def) If you are using latex', then callpdflatex'. (pdftex.def) Otherwise check and correct the driver options. (pdftex.def) Error recovery by switching to PDF mode.
See the pdftex.def package documentation for explanation.*

Error with the script:

--- warning --- Can't find/open file User_Manual.dvi' --- error --- Can't find/open fileUser_Manual.dvi' --- warning --- Can't find/open file `User_Manual.lg'
Could Not Find F:\Documents and Settings\My Documents\User_Manual_new\User_Manual.idv
Could Not Find F:\Documents and Settings\My Documents\User_Manual_new\User_Manual.lg
Could Not Find F:\Documents and Settings\tbinchisti\My Documents\User_Manual\User_Manual.html
Could Not Find F:\Documents and Settings\My Documents\User_Man ual_new\User_Manual.css

I believe it has something to do with the packages I have but I dont know which ones.

This is my main .tex file:

    \documentclass[11pt,a4paper]{report}  
    \usepackage{fancyhdr}  
    \usepackage[pdftex]{color,graphicx}  
    \usepackage{epstopdf}  
    \usepackage{lastpage}  
    \usepackage{makeidx}  
    \usepackage[english]{babel}  
    \usepackage{float}  
    \usepackage{subfig}  
    \usepackage{hyperref}  
    \usepackage{fullpage}  
    \usepackage{multirow}  
    \usepackage{appendix} 
    \usepackage{verbatim} 

        \renewcommand{\appendixtocname}{Appendix: Algorithm Parameters} \renewcommand{\appendixpagename}{Appendix-Algorithm Parameters}

        \setlength{\topmargin}{-1.3cm} \setlength{\headsep}{0.6cm}

        \renewcommand{\tablename}{\bfseries{Table}}

        %The top margin above a chapter can be changed using the titlesec package 

    \hypersetup{
            bookmarks=true,         % show bookmarks bar?
            unicode=false,          % non-Latin characters in Acrobat’s bookmarks
            pdftoolbar=true,        % show Acrobat’s toolbar?
            pdfmenubar=true,        % show Acrobat’s menu?
            pdffitwindow=false,     % window fit to page when opened
            pdfstartview={FitH},    % fits the width of the page to the window
            pdftitle={My title},    % title
            pdfauthor={Author},     % author
            pdfsubject={Subject},   % subject of the document
            pdfcreator={Creator},   % creator of the document
            pdfproducer={Producer}, % producer of the document
            pdfkeywords={keyword1} {key2} {key3}, % list of keywords
            pdfnewwindow=true,      % links in new window
            colorlinks=true,       % false: boxed links; true: colored links
            linkcolor=black,          % color of internal links
            citecolor=green,        % color of links to bibliography
            filecolor=magenta,      % color of file links
            urlcolor=cyan           % color of external links }

        \input{Macro} %\renewcommand{\caption}[1]{{\underline{#1}}}

        \makeindex

        \renewcommand{\headheight}{0.6in} %Space above header \renewcommand{\headrulewidth}{1pt} %thickness of line under header \renewcommand{\footrulewidth}{1pt} \newcommand{\HRule}{\rule{\linewidth}{0.5mm}} %thickness of line on title page

\setlength{\headwidth}{\textwidth}

\fancyhead[L]{\rightmark} 
\fancyhead[R]{\includegraphics[height=0.43in]{Images/Fugrologo.eps}} % right with logo \fancyfoot{}%to remove centered default footer 
\fancyfoot[L]{Fugro Roadware Inc.} 
\fancyfoot[R]{\thepage \  of \pageref*{LastPage}}% page# of reference page(last)

\fancypagestyle{plain}% no header, footer contains page number centered { 
\fancyhf{} %for the pages outside of content, list of figures etc. 
\fancyhead[R]{ \includegraphics[height=0.43in]{Images/Fugrologo.eps}} % right with logo

\fancyfoot[L]{Fugro Roadware Inc.} \fancyfoot[R]{\thepage \  of \pageref*{LastPage}} }

\pagestyle{fancy}
\usepackage[absolute]{textpos}



\begin{document}

\input{titlepage} 
\input{DocumentRevisionRecord}
\tableofcontents 
\listoffigures 
\listoftables 
\input{GettingStarted} 
\input{TourtheViews} 
\input{SetuptheWorkspace} 
\input{Map} 
\input{Video}
\input{SectionComposition} 
\input{Segmenting} 
\input{AutomaticMatching} 
\input{Events} 
\input{RoutingEditor} 
\input{DataAnalysis}
\input{CurveFitChapter} 
\input{BatchProcessing} 
\input{TransverseProfile}
\input{PavementModule}
\input{Dashboard} 
\input{TransferAssistant}
\input{DBGenerator} 
\input{DCS} 
\input{WiseCraxImporter} 
\input{RoutingImporter} 
\input{ReportingFramework}


\appendix 
\appendixpage 
\addappheadtotoc 
\input{Roughness} 
\input{CurveFit} 
\input{Faulting} 
\input{ERD} 
\input{Exif} 
\input{LCMSplugin} 
\input{Rut}
\input{PondingDepth} 
\input{Thumbnail}

\printindex

\clearpage 

\end{document}
share|improve this question
    
What command are you running? The first message looks like an error, but the second looks like only a warning. –  Matthew Leingang Jan 31 '12 at 15:22
    
You should post minimal example which causes the error, it seems you use some package which needs PDF output. –  michal.h21 Jan 31 '12 at 15:35
    
I am running- htlatex User_Manual.tex html "" -dhtml "--interaction=nonstopmode". I have tried with a small sample tex file and it worked which means htlatex is working. I have posted my main tex file above. I have tried running it without the hyperref package but I am getting the same error. –  S M Tadmir Bin Chisti Jan 31 '12 at 17:31
    
Just a thought (it is not possible to check the document you have provided): htlatex (tex4ht) works from the .dvi file, yet you are calling color and graphix with the [pdftex] option. This will be a problem. (I always comment out hyperref, too, when I convert.) –  jon Jan 31 '12 at 19:07

1 Answer 1

Try to change your preamble this way:

\documentclass[11pt,a4paper]{report}  
    \usepackage{fancyhdr}
    \makeatletter
    \@ifpackageloaded{tex4ht}{%
      \usepackage[dvips]{color,graphicx}
      \usepackage[tex4ht]{hyperref}
    }{%
      \usepackage[pdftex]{color,graphicx}
      \usepackage{hyperref}

      \setlength{\headwidth}{\textwidth}

      \fancyhead[L]{\rightmark} 
      \fancyhead[R]{\includegraphics[height=0.43in]{Images/Fugrologo.eps}} % right with logo \fancyfoot{}%to remove centered default footer 
      \fancyfoot[L]{Fugro Roadware Inc.} 
      \fancyfoot[R]{\thepage \  of \pageref*{LastPage}}% page# of reference page(last)

      \fancypagestyle{plain}% no header, footer contains page number centered { 
      \fancyhf{} %for the pages outside of content, list of figures etc. 
      \fancyhead[R]{ \includegraphics[height=0.43in]{Images/Fugrologo.eps}} % right with logo

      \fancyfoot[L]{Fugro Roadware Inc.} \fancyfoot[R]{\thepage \  of \pageref*{LastPage}} 

      \pagestyle{fancy}
      \usepackage[absolute]{textpos}
      \usepackage{fullpage}
    }
    \makeatother  

    \usepackage{epstopdf}  
    \usepackage{lastpage}  
    \usepackage{makeidx}  
    \usepackage[english]{babel}  
    \usepackage{float}  
    \usepackage{subfig}  
    \usepackage{multirow}  
    \usepackage{appendix} 
    \usepackage{verbatim} 

        \renewcommand{\appendixtocname}{Appendix: Algorithm Parameters} \renewcommand{\appendixpagename}{Appendix-Algorithm Parameters}

        \setlength{\topmargin}{-1.3cm} \setlength{\headsep}{0.6cm}

        \renewcommand{\tablename}{\bfseries{Table}}

        %The top margin above a chapter can be changed using the titlesec package 

    \hypersetup{
            bookmarks=true,         % show bookmarks bar?
            unicode=false,          % non-Latin characters in Acrobat’s bookmarks
            pdftoolbar=true,        % show Acrobat’s toolbar?
            pdfmenubar=true,        % show Acrobat’s menu?
            pdffitwindow=false,     % window fit to page when opened
            pdfstartview={FitH},    % fits the width of the page to the window
            pdftitle={My title},    % title
            pdfauthor={Author},     % author
            pdfsubject={Subject},   % subject of the document
            pdfcreator={Creator},   % creator of the document
            pdfproducer={Producer}, % producer of the document
            pdfkeywords={keyword1} {key2} {key3}, % list of keywords
            pdfnewwindow=true,      % links in new window
            colorlinks=true,       % false: boxed links; true: colored links
            linkcolor=black,          % color of internal links
            citecolor=green,        % color of links to bibliography
            filecolor=magenta,      % color of file links
            urlcolor=cyan           % color of external links }
        }
        \input{Macro} %\renewcommand{\caption}[1]{{\underline{#1}}}

        \makeindex

        \renewcommand{\headheight}{0.6in} %Space above header \renewcommand{\headrulewidth}{1pt} %thickness of line under header \renewcommand{\footrulewidth}{1pt} \newcommand{\HRule}{\rule{\linewidth}{0.5mm}} %thickness of line on title page

\begin{document}
bhg fgfgf hgh ghghgf fdfd 
\end{document}

important is the command \@ifpackageloaded{tex4ht}{true part ...}{false part ...}. Now we can exclude packages which aren't needed when htlatex is run, such as fancyheader settings, and we can have different settings for packages which causes errors. In this case graphicx with pdftex option, htlatex is running in dvi mode, so we can set it to dvips

share|improve this answer
    
Thank you so much for your script! It generated an html but all my images are missing. I am new to latex so could you please explain to me what you changed and why, and also why my images might be missing? My images are in JPG format. Commenting out the hyperref removed all the cross-references to all the pages on my index as well so is there any way to fix that? –  S M Tadmir Bin Chisti Jan 31 '12 at 22:14
    
Do you use file extensions in \includegraphics? Speaking of missing links, I don't know what can cause problem. –  michal.h21 Jan 31 '12 at 23:06
    
I have been able to resolve the problem with the images. I simply had to change the source directory. But now I need to solve the problem with the hyperlinks and also the TABLE OF CONTENTS and PAGE NUMBERS. Both are missing from my html document. The content page is simply empty. –  S M Tadmir Bin Chisti Feb 1 '12 at 20:24
    
Does any one know which package creates the Content page and which package creates the links to the images in the HTML file? I think it is to do with the packages. –  S M Tadmir Bin Chisti Feb 6 '12 at 22:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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