Writing a LaTeX document that you want to feed to both plain latex and pdflatex can be sometimes a conflicting task. If you want to embed graphics for example, latex needs EPS based graphics but pdflatex needs PDF based graphics. Other problems can occur if you want to use some PDF specific functionality like bookmarks and other navigational stuff. With the use of the package ifpdf, you can write conditional LaTeX code in your document.

The package defines a switch \ifpdf, which you can use as in the following simple example:

\documentclass{article}

\usepackage{ifpdf}

\begin{document}

\ifpdf
  pdflatex was here
\else
  plain latex was here
\fi 

\end{document}