Creating PostScript from a Web Interface
One interesting use of the PostScript modules is as a means of creating printable documents from CGI scripts on the Web. As an example, we’ll design a web page for an online record label, Apocabilly Records, that ships every purchase with a shipping invoice. Our web page processes the order and creates a PostScript shipping invoice all at once.
The web page takes information submitted from an HTML form and calls a script called processorder.cgi, which logs the order in some sort of database and creates the shipping invoice. The web page that the customer sees is shown in Figure 11-1. It is assumed that prior to this point, a shopping-cart script was used to catalog the user’s selections as he navigated the site.
The HTML code for this web page would look something like Example 11-1. Notice the FORM element, with fields to retrieve the customer’s name, address, and city/state/zip, and the hidden text fields containing the merchandise order and the total amount of the purchase. These fields were created by our hypothetical shopping-cart script and passed on to the processorder.cgi script upon submission of the form for inclusion in the final shipping invoice.
<HTML> <HEAD> <META HTTP-EQUIV="Content-Type" ...
Get Perl Graphics Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.