1

Right now I'm working on displaying LaTeX generated document with Java.

Strictly speaking, LaTeX source can be used to directly generate two formats:

  • DVI using latex, the first one to be supported;
  • PDF using pdflatex, more recent.

However rendering dvi or pdf is not available as far as I know.

Is there any way to handle those formats ? Or maybe others that makes sense ?

hsz
  • 148,279
  • 62
  • 259
  • 315

2 Answers2

1

There are not enough details with regards to how you wish to "render" DVI or PDF from a LaTeX document. However, you could always just render the pdf using pdflatex and DVI using latex and use ICEpdf for viewing PDFs and javaDVI for viewing DVIs.

Another neat hack to display pdf in a panel is to pass the file path to an embedded web component in the application, and the web component will use whatever pdf rendering tool is available on your machine (Acrobat, Foxit, Preview, etc.) I remember there was a post about this a long time ago.

I don't think there's a generic way to preview the rendered output without generating the file itself. You can write your own LaTeX engine which caches the output every few seconds and displays that but regardless of the storage, you have to output it somewhere physically and then render the output separately using any of the steps mentioned above.

Community
  • 1
  • 1
Sid Shukla
  • 990
  • 1
  • 8
  • 33
0

Another approach is to convert the div output to an svg image file and render that with SVGGraphics2D. That will produce nice scalable results. Dvi files can be converted to svg on the command line (or in a script) using:

dvisvgm --no-fonts input.dvi -o output.svg

For more conversion options see this thread on how to convert pdf to clean svg.

Community
  • 1
  • 1
ennob
  • 53
  • 3