Re: examples using PDF::Template
From: Michele Dondi (bik.mido_at_tiscalinet.it)
Date: 12/10/04
- Next message: cassiux: "Re: Insert JavaScript into Perl"
- Previous message: Michele Dondi: "Re: Parsing Huge Files"
- In reply to: botfood: "Re: examples using PDF::Template"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 10 Dec 2004 00:33:29 +0100
On 8 Dec 2004 09:16:04 -0800, "botfood" <botfood@yahoo.com> wrote:
>after a night of poking around, and you all's input, it looks like
>creating .pdf files on the fly is a pretty involved and painful
>process. PDF::Template has potential for what I want to do, but
>requires learning special XML syntax to set up the template, and buying
>the PDFlib for about $450. PDF::Create has some simple capabilities,
>but neither look straightforward to use in a mail-merge application as
>there are some complex issues with pagination and text position.
[snip]
>if there is somebody out there who has actually used PDF::Create and/or
>PDF::Template and would like to share some thoughts on the
>capabilities/limitations, ease of use, examples, etc, I still think it
>would be great to share some knowledge of these packages.
Well, I can't share any experience on the packages you mention, but I
may try insisting on the pdfLaTeX route. See this fictious example:
#!/usr/bin/perl
use strict;
use warnings;
die "Usage: $0 <template>\n" unless @ARGV == 1;
open my $fh, '|-', 'pdflatex' or
die "Can't pipe into pdfLaTeX: $!\n";
select $fh;
while (<>) {
s/ <<CODE>> / \\lstinputlisting{$0} /x;
print;
}
__END__
called with the following template as argument
\documentclass[a4paper,12pt]{article}
\title{A Minimal Example}
\author{Me Myself}
\date{\today}
\usepackage{color}
\usepackage[bookmarks=true,
bookmarksnumbered=true,
colorlinks=true,
linkcolor=blue,
pdfpagemode=None,
pdfstartview=FitH]{hyperref}
\makeatletter
\newcommand\org@maketitle{}
\let\org@maketitle\maketitle
\def\maketitle{%
\hypersetup{
pdftitle={\@title},
pdfauthor={\@author},
pdfsubject={Nothing more than a minimal example},
pdfkeywords={minimal example}
}%
\org@maketitle
}
\makeatother
\usepackage{listings}
\begin{document}
\maketitle
\lstset{language=Perl,
basicstyle=\small\ttfamily,
commentstyle=\color{white},
stringstyle=\color{blue},
keywordstyle=\color{red},
backgroundcolor=\color[gray]{0.80},
xleftmargin=2em,
frame=single,
framexleftmargin=2em,
showstringspaces=no,
numbers=left,
numberstyle=\tiny,
numbersep=2em}
\section{What is all this about?!?}
This is just a minimal example{\ldots} here's the code I used to
generate
this document from a template:
<<CODE>>
\end{document}
Running the perl program will leave a texput.pdf output file in the
cwd.
If you want to see a sample output, you can find it at
<http://mosquito.scumm.it/~blazar/example.pdf>.
Of course all this is very rough, and I remember having seen more
refined examples somewhere, however I don't have any link offhand.
IIRC someone even set up a TeX sort of daemon especially aimed at
"this kinda things"...
>I realize that some people feel this group is for asking questions
>after you get stuck... but I HOPE there are also people out their
>interested in sharing experiences with specific packages to help others
>evaluate alternatives before investing a lot of learning time and test
>code.
Hope the above helps.
Of course the solution I'm proposing requires having a TeX system
installed, which is not a problem for me, since I need it anyway...
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
- Next message: cassiux: "Re: Insert JavaScript into Perl"
- Previous message: Michele Dondi: "Re: Parsing Huge Files"
- In reply to: botfood: "Re: examples using PDF::Template"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|