
\definefilesynonym
  [font-lbr] [font-pos]

\usemodule[pre-01]

%\setupbodyfont
%  [ber,pos]

\let\section\Topic
\let\subsection\Subject


\useexternalfigure[fig:complexform][complexform][factor=max]
\useexternalfigure[fig:baform][baform][factor=max]
\useexternalfigure[fig:seprform][seprform][factor=max]
\useexternalfigure[fig:sumvouch][sumvouch.1][factor=max]
\useexternalfigure[fig:labsched][labsched][factor=max]

\useexternalfigure[fig:process1][process1][factor=max]
\useexternalfigure[fig:process2][process2][factor=max]
\useexternalfigure[fig:process][process][factor=max]
\useexternalfigure[fig:process_server1][process_server1][factor=max]
\useexternalfigure[fig:process_server2][process_server2][factor=max]
\useexternalfigure[fig:process_server][process_server][factor=max]
\useexternalfigure[fig:process_graphics1][process_graphics1][factor=max]
\useexternalfigure[fig:process_graphics2][process_graphics2][factor=max]
\useexternalfigure[fig:process_graphics3][process_graphics3][factor=max]
\useexternalfigure[fig:process_graphics4][process_graphics4][factor=max]
\useexternalfigure[fig:process_graphics5][process_graphics5][factor=max]
\useexternalfigure[fig:process_graphics6][process_graphics6][factor=max]



\starttext

\startstandardmakeup
\midaligned{{\tfd \PDFTEX\ in a Workflow}}
\blank[2*big]
\midaligned{{\tfc Ed Cashin}}
\blank[6*big]
\midaligned{{\tfb TUG2000}}
\midaligned{{\tfc August 2000}}
\stopstandardmakeup


\Topics{Contents}


\section{Why PDF?}

\subsection{portable}
\startitemize
\item	Some like Word; some like WordPerfect.
\item	Most have Acrobat Reader \dots
\item	Others can get it for free.
\item	Ideally, PDF documents will look the same everywhere.
\stopitemize

\subsection{quality}
\startitemize
\item	Looks great: scalable graphics and fonts print well and are
	attractive on screen.
\item	The medium provides sufficient accuracy for ``dense'' formats,
	e.g., business forms.
\stopitemize

\placefigure[page]{complex form}{\externalfigure[fig:complexform]}

\section{Centralization}

\subsection{data}

With centralized data, advantages include:

\startitemize
\item	Easier collaboration
\item	Multi-point access via the web
\item	Data security through server backups
\stopitemize

\subsection{services}

With centralized services \dots

\startitemize
\item	Functionality is not limited by the software on the end user's
	machine 
\item	Complexity is hidden from the user
\stopitemize

\section{The Problem}

\startitemize
\item	No PDF on the fly

	Most of the time, users cannot get PDF documents that are
	generated from centralized, on-server data.
\item	GUI

	Most PDF software is GUI-based and oriented toward interactive
	use.
\item	Server environment must be batch-oriented.
\item	Users often dislike learning new things.
\item	Long waits are confusing to users.
\item	Quicker service leads to greater acceptance.
\stopitemize

\section{The Solution}

\startitemize
\item	While \PDFTEX\ can be used interactively, it is also well behaved in
	the batch processing environment of a server.
\item	The full power of \TeX\ and friends is available for structured
	documents. 
\item	The full power of PDF graphics is available with \METAPOST.
\item	\PDFTEX\ is very fast because Knuth was conservative with
	computer resources.
    \startitemize
	\item	users are happy
	\item	server is happy
    \stopitemize
\stopitemize

\section{The Glue}

To make it work, we must glue things together.

One way is to use perl to glue the web server to \TeX\ and friends. 

\section{The Process}

Overview:

\startitemize
\item	User comes to the web site
\item	User clicks something, and web server invokes perl
\item	Perl invokes \PDFTEX
\item	Perl serves PDF document to user and cleans up
\stopitemize

\page
\startalignment[middle]
\placefigure[page]{the user}{\externalfigure[fig:process1]}
\placefigure[page]{the user interface}{\externalfigure[fig:process2]}
\placefigure[page]{behind the browser}{\externalfigure[fig:process]}
\placefigure[page]{perl makes \TeX\ source}{\externalfigure[fig:process_server1]}
\placefigure[page]{perl calls \PDFTEX}{\externalfigure[fig:process_server2]}
\placefigure[page]{\PDFTEX\ generates PDF}{\externalfigure[fig:process_server]}
\stopalignment

\subsection{graphics}
What about graphics?

\startitemize
\item	The old way: perl invokes \METAPOST
\item	The new way: \TeX\ invokes \METAPOST\ {\em itself}
\stopitemize

\startalignment[middle]
\placefigure[page]{perl creates MP source}{\externalfigure[fig:process_graphics1]}
\placefigure[page]{perl invokes \METAPOST}{\externalfigure[fig:process_graphics2]}
\placefigure[page]{\METAPOST\ produces graphic}{\externalfigure[fig:process_graphics3]}
\placefigure[page]{MP graphic and \TeX\ source}{\externalfigure[fig:process_graphics4]}
\placefigure[page]{\TeX\ puts them together \dots}{\externalfigure[fig:process_graphics5]}
\placefigure[page]{\dots to make PDF}{\externalfigure[fig:process_graphics6]}
\stopalignment



\section{Templates}

\blank[medium]

In creating source code for \TeX\ and \METAPOST, we can do \color[red]{text
substitution} on \color[red]{templates}.  

Templates provide a simple and easy to maintain means for code
generation.

\subsection{example template}
\starttyping
    
    \starttext
    Dear Dr. X-@professor@-X,
    
    You have won X-@dollaramount@-X dollars.
    
    Sincerely,
    
    Joe
    
    \stoptext
    
\stoptyping

\section{Examples}

\subsection{online letter}

An early use of \PDFTEX\ as an engine for producing PDF documents for
web users was a letter.

\startitemize
\item	User fills out HTML form that looks like the letter
\item	The data the user just supplied is stored in a database
\item	The user gets a PDF version of the letter, ready to print.
\stopitemize

\subsection{business forms}

The University of Georgia's business office is notoriously picky when
it comes to the forms that it will accept.  If the form is not exactly
the way they want it, they will not accept the form.

With \PDFTEX\ and \METAPOST\ working behind the scenes, we are able to
produce extremely accurate reproductions of the Business Office's
originals.  

The staff use a web interface to enter data, retrieve data, and
generate documents.

\placefigure[page]{Employee Personnel Report}{\externalfigure[fig:complexform]}
\placefigure[page]{Budget Amendment}{\externalfigure[fig:baform]}
\placefigure[page]{Student Personnel Form}{\externalfigure[fig:seprform]}
\placefigure[page]{Summer Employment Voucher}{\externalfigure[fig:sumvouch]}

\subsection{lab schedules}

Our department manages many computer labs.  A coworker made a web
interface for managing the labs.  His code uses a perl module I wrote
that uses a \CONTEXT\ backend to create lab schedules that we post.

The earlier solution used substitution on raw postscript.  The
postscript files were huge, and the results were flakey.  Now
everything just works!

\CONTEXT\ was chosen to manage the interdependent text and graphics.

\placefigure[page]{computer lab schedules}{\externalfigure[fig:labsched]}

\section{Tips}

\startitemize
\item	Redirect standard input for immediate failures \dots

	\type{pdftex foo < /dev/null}

	\dots\ instead of hanging browsers!

\item	Use strange markers in templates,

	e.g., \type{X-@foobar@-X} for ``foobar''.

\item	Do all work in a cleverly-named temporary directory.

	Use symlinks if available.

\item	Use plain format for documents with little structure.

\stopitemize

\page[empty]

\stoptext
