printing over html

Brian K. White brian at aljex.com
Fri Aug 26 13:05:03 PDT 2005


----- Original Message ----- 
From: "Enrique Arredondo" <henry at vegena.net>
To: <filepro-list at lists.celestial.com>
Sent: Friday, August 26, 2005 3:04 PM
Subject: printing over html


>I have 2 venders with a computer running SCO unix and filepro, they have a 
>filepro menu which let's them print tags on a barcode printer. Now, this 
>setup is quite obsolete because the database changes by the minute and they 
>are always missing new parts or modifications on the information. So my new 
>project that I want to make is something like this:
>
> I'll create a webpage with 2 fields, (i.e. Part and serial number) then as 
> soon as they hit submit button the cgi script will run filepro at my 
> server and generate the report that would normally print on a barcode 
> printer (all special print codes plus barcode information), So here's the 
> hard part, how can I make so that this file gets printed on the remote 
> printer ? Is there a special command on HTML to do that ? When I *cat* the 
> file back  to them would it be like :
>
>    echo Content-Type : print/file
>
>     cat $FILE
>
>   So their windows system asks them right away to choose their printer and 
> after selecting the barcode printer it will print .
>
> Here is a vague idea of how my cgi script would look like :
>
> ---------- cut here ---------------
> RECVDINFO=`cat`
>
> ./setfpenviroment
>
> report printing -f barcode -u -r $RECVINFO -p REPORT
>
> if [ -s REPORT ]
> then
>
>     echo Content-type : print/plain
>     echo
>
>     cat REPORT
>
> fi
>
> ------------- cut here --------
>
> Don't worry about the syntax , it's just an example of the idea. So here 
> REPORT is a filepro generated HTML or report file that has to make the 
> remote machine print the file. Do I make sense ?
>
> Is that possible ? I can do this same thing with paypal and ebay, every 
> time a ship something to my buyers paypal prints on my laser printer a 
> USPS shipping label with barcodes.

I never heard of print/* as a mime type, so I can't say it won't work.

The only way I know to get  web page to print automatically is with this:
<body onLoad="javascript:window.print()">

That pops up the print dialog with the focus on the OK button and one of the 
available printers selected.
The user has to press Enter at the very least.

And this is no good to you because it prints the visual contents of the web 
page. It wouldn't work for a special file full of printer codes. It would 
print the text of the codes.

You might be able to have fp print to a file in .../htdocs/tmp and use the 
run-program feature in Anzio or FacetWin to run a command on the pc to wget 
the file and copy it to LPT1
If the printer is serial or usb or on a network print server then you'll 
have to figure out some other command(s) besides example: "copy %1 LPT1" to 
print the file.
If it's serial or network the commands are just as easy, usb I have no idea.
You might be able to use the windows sharing mechanism to send it to a usb 
printer by sharing the label printer and doing "copy %1 
\\computername\sharename"

You'll need to delete the temp file after a few minutes to keep them from 
accumulating forever. I solve this by having a special directory ptmp that a 
cron job runs every minute and deletes all files older than some 
configureable number of minutes. I write all kinds of temp files there that 
are intended to be immediately popped up in a web browser. I don't know how 
long the web browser will take to fetch the file, and I don't want to pause 
the fp process table waiting 30 seconds just so it can delete the temp file, 
so I writeto ptmp, immediately issue a winstart command with a url to the 
file, and never look back. it will get deleted by the cron job X minutes 
after it was created and I don't have to hang the fp process and I don't 
care how slow the users net connection is or how big the file is, and the 
temp files never accumulate. You could do that (I'll share the script and 
directions) or you could make a cgi script that deletes the file. In the 
batch file that you trigger on the pc that downloads the temp file, you add 
another wget command at the end that tells the cgi script that you got file 
xyz, the cgi script then deletes xyz.

Brian K. White  --  brian at aljex.com  --  http://www.aljex.com/bkw/
+++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++.
filePro  BBx    Linux  SCO  FreeBSD    #callahans  Satriani  Filk!



More information about the Filepro-list mailing list