Re: [flpsed] using flpsed with a perl program

From: Johannes Hofmann <Johannes.Hofmann_at_gmx.de>
Date: Sat, 4 Dec 2010 11:09:33 +0100

Hi,

On Fri, Dec 03, 2010 at 04:18:16PM -0500, Bonnie Dalzell wrote:
>
> Thank you so much for flpsed.
>
> I raise dogs and there are "official" record pages that the American
> Kennel Club wants breeders to keep in hard copy format. I needed to
> make 50 different versions of this page.
>
> The page is available as a PFD but is not editable.
>
> I used flpsed and Perl to make an editable one that can also be
> stored on the computer in editable form so that changes can be made
> without having to retype all the information.
>
> I do not know the PS language but what I did was to make a master
> editable form with flpsed entering variable names where I wanted to
> fill in the form. (such as $dog_name).
>
> Then I saved this flpsed .ps form.
>
> Then I opened the .ps document in gedit and made three different
> files out of it.
>
> file 1 is called prolog and contains everything prior to the line:
>
> % PSEditWidget Begin
>
> file 2 contains the portion between:
>
> % PSEditWidget Begin
>
> and
>
> % PSEditWidget End
>
> This file 2 contains my variable names.
>
> file 3 is everything past the
>
> PSEditWidget End
>
> line.
>
> so I made the contents of file 2 a HERE document in a subroutine and
> I set the values submitted from the form in %param equal to the
> variables in file 2.
>
> Subroutine opens file 1 into an array. prints that out to the new
> document (which takes its name from the dog's name); prints out the
> HERE routine to the new document; opens file 3 into an array and
> prints it out to the new document.
>
> Result is a filled out postscript page with the information
> submitted from from an html form.
>
> however since file 3 contains a big binary section it does not work
> in Perl for me with taint turned on so right now it is only useful
> for local use on my system.
>
> I am not sure how to contain the binary block in a variable within
> the program yet.
>
> I discovered that using the html submission form variable <textarea>
> resulted in a document readable in flpsed but not printable on my
> system (Ubuntu Linux) as textarea submits line feeds to the cgi
> program which then are passed through to the variable values. need
> to get rid of the line feeds in variables before sending the
> document out to the final .ps file.

Actually it sounds like you have reimplemented something that
already exists within flpsed itself :-)

If you want to repeatedly fill in forms you can use the "Tags"
feature (see "Tags and Batch Mode:" section in the README file).
http://www.flpsed.org/hgweb/flpsed/file/tip/README

So I would suggest to give all entries you made in flpsed a tag
(e.g. dog_name), save the document as master copy, and from your
perl CGI call flpsed in batch mode, e.g.
flpsed -b -t dog_name="Bo" -t dog_weight="20" master.ps out.ps

Let me know if you are having problems with this approach.

Thanks for the feedback,
Johannes
Received on Sat Dec 04 2010 - 11:09:33 CET

This archive was generated by hypermail 2.2.0 : Sat Dec 04 2010 - 11:10:02 CET