TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to create PNG images for each page in a LaTeX document on the fly. Since the startup time of LaTeX is the limiting factor for speed I tried the following approach using names pipes:

Bash 1 (listening):

mknod test.dvi p # create named pipe 'test.dvi'
dvipng test.dvi  # let dvipng wait for input on that named pipe

Bash 2 (sending):

echo "\\documentclass{article}\\pagestyle{empty}\\begin{document}text\\end{document}" \ 
    | latex -jobname=test # typeset small LaTeX document into test.dvi

The LaTeX run finishes successfully. But dvipng quits with the following error:

dvipng: Fatal error, POST occurs within page

Surprisingly, dvipng works as expected when I redirect the test.dvi to a regular file using

cat test.dvi > test2.dvi
dvipng test2.dvi # results in test21.png

on Bash 1.

Hopefully, I can sent continuous data to LaTeX so that dvipng outputs a .png each time latex outputs a page to test.dvi. If you have better approaches than the one above please let me know! Note that I also precompiled the preamble of the LaTeX document. But this is still not fast enough.

share|improve this question
Is it easier to create a pdf and convert that into individual pngs? – mlt Oct 5 '12 at 17:35
Maybe pdflatex and a tool for png conversion would solve the pipe related issue. But pdflatex is slow compared to latex. Also, dvipng is very fast. Currently I use a RAM disk to solve the speed issue. But using pipes would be much nicer. – porst17 Oct 5 '12 at 21:35

You may want to investigate the TeX-daemon: It comes with a special program dvichop than can extract new pages from TeX's dvi-output piped into it.

share|improve this answer
But how does this help in creating PNG files for these pages? – porst17 Jan 19 '13 at 10:23
@porst17: My impression was that your problem starts with getting correct dvi pages continuously from LaTeX. – Martin Schröder Jan 19 '13 at 12:33

Your Answer


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.