On Tuesday 23 November 2004 18:29, David Wall wrote: > I have an existing PDF form (actually lots of them) and my webapp is > querying a user for the "missing data" on the HTML form. I'd like to merge > the POST data into the PDF document and end up with a new filled out PDF > document. Has anybody done this or can point to tools that will help?
Hi,
I don't know about merging, but my application generates and HTML file and
uses a linux utility (html2ps) to convert this to Postscript.
Then depending on wether the user selects and e-mail address or fax number
will convert the PS toPDF file using another linux utility (ps2pdf) and
e-mail it to the user or send the PS file directly to our fax server.
Basically I create a mini-shell script on the server at run-time that looks
like this:
FileOutputStream fisScript = new FileOutputStream(filScript, false);
PrintWriter pwrScript = new PrintWriter(fisScript);
pwrScript.write("#!/bin/bash\n");
pwrScript.write("/usr/bin/html2ps -U -O -o " + strPSFileName + " " +
strHTMLFileName + "\n");
pwrScript.write("/usr/bin/ps2pdf " + strPSFileName + " " + strTempPDFFileName
+ "\n");
pwrScript.write("/bin/mv " + strTempPDFFileName + " " + strPDFFileName + "");
pwrScript.close();
I then create a command string variable:
String strCommand = "/bin/bash /data/intsys/training/invoice/" + strLedgerID +
".sh";
I then execute the script using this:
Process ls_procPS = Runtime.getRuntime().exec(strCommand);
Works like a charm. :)
Just make sure that the user that tomcat runs as (wwwrun pre 5) or (tomcat
post 5) has read and write access to the relevant directories.
I use a similar principal when the user wants to view the file instead, all
that I do is generate the PDF and then redirect the browser to the location
of the PDF.
> Thanks,
> David
Q
--
Quinton Delpeche
Internal Systems Developer
Softline VIP
Telephone: +27 12 420 7000
Direct: +27 12 420 7007
Facsimile: +27 12 420 7344
http://www.vippayroll.co.za/
The Roman Rule
The one who says it cannot be done should never interrupt the
one who is doing it.
pgpnIlgZLqUIA.pgp
Description: PGP signature
