tags:

views:

163

answers:

3

I'm looking for a tool to nicely generate single-page PDFs. My needs are:

  • Able to put a PDF/EPS/... as a background
  • Absolute positioning
  • Able to define tables, lists
  • Able to rotate blocks
  • Reasonably easy syntax (will be used to automatically generate many similar looking documents)
  • Easily usable from Python
  • Free or very cheap

In essence I'm looking for the tool X that is to OODraw/CorelDraw/... as LaTeX is to OOWrite/MS Word.

I've looked at webkit2pdf and a headless OODraw, but both seem a bit of an overkill. XML-FO has some limitations such as not being able to predict how many pages your document spans. Reportlab is pricey.

Any ideas?

Thanks!

+11  A: 

Definitely PGF/TikZ. Selling point:

Created by this code:

% Rooty helix
% Author: Felix Lindemann
\documentclass{minimal}

\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}

\pagestyle{empty}
\pgfdeclarelayer{background}
\pgfdeclarelayer{foreground}
\pgfsetlayers{background,main,foreground}

\xdefinecolor{darkgreen}{RGB}{175, 193, 36}
\newcounter{cntShader}
\newcounter{cntRoot}
\setcounter{cntShader}{20}
\def\couleur{darkgreen}

\begin{tikzpicture}
    \foreach \y in {86,38,15}{
        \setcounter{cntShader}{1}
        \coordinate (a) at (0,0);
        \coordinate (b) at (0:1);
        \foreach \x in {1,...,\y}{%
            \coordinate (c) at ($ (b)!1cm!270:(a) $);
            \begin{pgfonlayer}{background}
                \draw[fill=\couleur!\thecntShader] (a)--(b)--(c)--cycle;
            \end{pgfonlayer}
            \setcounter{cntRoot}{\x}
            \addtocounter{cntRoot}{1}
            \node[fill=white,draw,circle,inner sep=1pt] at (c)
                {$\sqrt{\thecntRoot}$};
            \coordinate (b) at (c);
            \pgfmathsetcounter{cntShader}{\thecntShader+4}
            \setcounter{cntShader}{\thecntShader}
       }
    }
    \node[fill=white,draw,circle,inner sep=1pt] at (0:1) {$\sqrt{1}$};
\end{tikzpicture}

\end{document} 

Blatantly stolen from the examples.

Konrad Rudolph
You can even precise that this is still LaTeX!
Lohrun
A: 

ReportLab might be a good solution:

The ReportLab Toolkit is the time-proven, ultra-robust open-source engine for programatically creating PDF documents and forms the foundation of RML; it also contains a library for creating platform-independent vector graphics. It's a fast, flexible, cross platform solution written in Python.

http://www.reportlab.com/software/opensource/

djc
+3  A: 

An alternative to TikZ is using Metapost with Context: this is a slightly more expressive language than PGF, the basis language for TikZ, within a Tex-based processing language, Context, that is better suited for page layout in PDF than either Latex or Plain Tex.

Three points in favour of Context/Metapost:

  1. The key expressive advantage Metapost has over PGF is that it is a constraint-solving language that can determine the intersection of curves. This allows one to specify recursive algorithms for tree layout, say, that pack the trees as closely as possible without overlap, something that can't be done in PGF. See section 9 of The Metapost user manual;
  2. Context's layers allow PDF images to be inserted behind text or other PDF images fairly easily. See the entry on Layers at the Context wiki;
  3. Context allows page layout to be specified with respect to grids, something that is really unpleasant to do with Latex. See section 3.4 of Context: the manual.

And three in favour of Latex/TikZ:

  1. They're better documented and more widely used.
  2. TikZ has a lovely library of sample graphics.
  3. TikZ works with all the major Tex implementations, whilst Context is tied to Luatex.

The best place to start finding out about using Context with Metapost are the two (long!) introductory guides by Hans Hagen: Context: an excursion and Metafun (Metafun is an implementation of Metapost with some extensions).

Charles Stewart