[Tex/LaTex] Compiling LaTeX straight to an image

compilinggraphics

This is probably going to sound like a strange request (trust me that there's a good reason for it), but is it possible to have LaTeX compile straight to an image file instead of to something like PDF, PostScript, or DVI? I know there are probably good ways to convert those formats to an image instead, but I figured I would see if there was a more direct route.

Some requirements:

  • The image format can be either PNG or JPG.
  • I'm not looking just for a single expression or something (I'm aware of tools like tex2im). I want to compile an entire document.
  • There should be one image for each page in the corresponding PDF, with the same resolution, margins, etc. It should be identical to just converting each page faithfully.

In case this turns out to be impossible for some reason, I would also be happy with a simple conversion routine to accomplish this with a PDF generated by pdflatex.

Thanks!

Best Answer

Probably the best way is latex followed by dvipng. The main advantages over pdflatex followed by pdf2png are: it is faster; it can start working on the dvi while latex is still in the process of producing the dvi. It's optimized for producing screen-resolution antialiased images at maximum speed. If your foo.dvi has 4 pages then you get foo1.png foo2.png foo3.png foo4.png.

Related Question