Re: Printing on a local printer
| From: | David Bouw | Date: | Sun, 24 Dec 2000 00:19:01 +0000 |
| Subject: | Re: Printing on a local printer | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-31720@lists.php.net to get a copy of this message | ||
Hmmm, you guys are making it sound more difficult than it sounds.....
I am freelancer and made the ordering software for a small E-commerce site..
(www.perfectbody.nl)
In the above example the problem was that when an order was made COD (cash
on delivery) there
needs to be printed 3 papers.
The first is the shipping paper, which must be done on a matrix printer
because it has 4 layes paper with carbon paper in between.
The second is the paper which the post-man takes with him to pay the sender
of the package
The last is the bill that the receiver gets from the company..
Because the shipping paper is on a chain, it is necessary to print very
exactly..
There are two approaches: 1 is to create a HTML document which should be
printed by hand.. Nice thing about this is that
you can print this from any machine without any aditional software.
The other option which is far better, is to generate a PDF file. I used this
approach..
For each paper we have a seperate printer. Because there were some old 486
machines laying around I used one for every printer.
(This was easier and cheaper time-wise than installing and fiddling with an
extra printer ports for one machine.)
The PDF's are generated and when an order is made the 3 machines start
processing there jobs and prints all papers..
The nice thing about PDF's is that they can be stored away easily in an
database to exactly get an copy of all papers when problems arrive.
Only problem with the above setup, is that it's a bit spooky because when
someone else in the world places an order the printers start to
print an order no-one knows about or has ever seen.. :-)
This also creates an problem when some joker places 1000 fake orders.. :-)
Well, the PDF generation can be done with PDFlib of ClibPDF.. The printing
can be done with ghostscipt..
PDFlib is compiled into PHP, it shouldn't be hard to ask an administrator to
do this.. You need access to the printer port, if you can get this, you will
probably also have
the possibilities to install such a package if needed..
Nice thing when generating PDF's, is that you can also enbed barcode fonts..
With this you can give the client a barcode number when he makes his orders
which is then
also printed on the shipment papers..
Well, hope this helps..
Bye Bye
> I _have_ to use the pre-printed forms so I can't generate a "browser
> version" and simply let the user print it.
>
> I'm on Linux and can't install pdflib or use Adobe software.
>
> Because I am in a controlled environment I could use JS.
>
> Any examples?
>
> Thanks for all your help!
>
> Simon.
>
> > -----Original Message-----
> > From: Cynic [mailto:cynic@mail.cz]
> > Sent: zaterdag 23 december 2000 18:15
> > To: James Moore; Kraa de Simon; Kraa de Simon; Php-General (E-mail)
> > Subject: RE: [PHP] Printing on a local printer
> >
> >
> > He needed to print out some forms, and IIRC it was in a
> > controled environment, so javascript shouldn't really be
> > a problem. BUT, if he can produce images (create image of
> > a form? eh, ugly), he can produce PDF documents, as well.
> > IF his server is win32 based, and IF either of the two
> > PDF libs can't be used on that platform, he would have to
> > resort to spending one hell of a budget on Adobe Distiller
> > or what it's called, and create the documents in that through
> > COM. But this discussion isn't leading nowhere, because we
> > don't know what system's he running, whether he can use / buy
> > the Adobe software, etc...
> >
> >
> > At 18:10 23.12. 2000, James Moore wrote the following:
> > --------------------------------------------------------------
> > >Well then we are into dcom.. it requires the user to have to
> > correct com
> > >objects and also you probably to be running a win 2k server
> > then use com to
> > >create the word document.. let the user download it (maybe
> > its even possible
> > >with com to force this to happen) and load it into their
> > version of word but
> > >I really doubt this is possible.. I can see so many security
> > things in there
> > >that I dont think you could do it like that.. maybe creating
> > an image is an
> > >option then using javascript print() (which 99% of the time in 99% of
> > >browsers is disabled for obvious reasons) the other option
> > is Java appelets
> > >or somesuch but thats the best I can come up with.. its not
> > easy as it can
> > >be used malicously I would be in favour of creating a nice
> > HTML page and
> > >makeing the user choose file->print from their menu.. thats
> > what we normally
> > >do in shoppingcart systems with orders and loose the
> > horrible pre printed
> > >orderforms.
> > >
> > >James
> > >
> > >> -----Original Message-----
> > >> From: Cynic [mailto:cynic@mail.cz]
> > >> Sent: 23 December 2000 17:01
> > >> To: James Moore; Kraa de Simon; Kraa de Simon; Php-General (E-mail)
> > >> Subject: RE: [PHP] Printing on a local printer
> > >>
> > >>
> > >> James,
> > >>
> > >> this is nice, but the guy was looking for a way to CREATE
> > >> PDF documents WITHOUT pdf_* functions. PLUS he wanted to
> > >> print them on the client, not the server, and I hesitate
> > >> to assume it's gonna be one machine.
> > >>
> > >>
> > >> At 17:59 23.12. 2000, James Moore wrote the following:
> > >> --------------------------------------------------------------
> > >> >If itsa all running on a local computer then you might also want
> > >> to look at
> > >> >COM in PHP to open up your acrobat doc and print it out.. Its
> > >> very possible
> > >> >but I wouldnt want to be the person doing it as your going to be
> > >> using a lot
> > >> >of code that hasnt been used thourghly so might run into
> > the odd querk..
> > >> >rember to report any you find but somthing like
> > >> >
> > >> ><?php
> > >> >// Get Data Here...
> > >> >
> > >> >$pi = pdf_open(...);
> > >> >// Create PDF here using PDF_* functions
> > >> >// save PDF
> > >> >
> > >> >$ai = new COM(application.acrobat);
> > >> >$ai.open(pdf file);
> > >> >$ai.print();
> > >> >$ai.close(pdf file);
> > >> >?>
> > >> >
> > >> >That would print on the server computer.. you would need dcom
> > >> etc otherwise
> > >> >and Im totally unfamiliar with that but hopefully that
> > will give you a
> > >> >pointer in the right direction (PS all my functions are probably
> > >> wrong and
> > >> >are just there to give psudo code).
> > >> >
> > >> >James
> > >> >--
> > >> >James Moore
> > >> >PHP Quality Assurance Team
> > >> >jmoore@php.net
> > >> >
> > >> >> -----Original Message-----
> > >> >> From: Cynic [mailto:cynic@mail.cz]
> > >> >> Sent: 23 December 2000 15:58
> > >> >> To: Kraa de Simon; Kraa de Simon; Php-General (E-mail)
> > >> >> Subject: RE: [PHP] Printing on a local printer
> > >> >>
> > >> >>
> > >> >> No, you cannot.[*]
> > >> >> You need a software that will _create_ the PDF's. You wouldn't
> > >> >> be able to use mysql_* functions in PHP if MySQL client wasn't
> > >> >> compiled into PHP. When you want to create PDF documents from
> > >> >> within PHP, you need a software that will do it, and compile
> > >> >> PHP with support for that software. You can either use PDFLib
> > >> >> or CLibPDF.
> > >> >>
> > >> >> * You could probably create PDF documents from within PHP
> > >> >> _without_ either of these _provided_ you:
> > >> >> 1) were on windows,
> > >> >> 2) had software from Adobe capable of creating PDF files
> > >> >> (not Acrobat Reader - it's called Reader for a reason)
> > >> >> 3) that software had COM interface
> > >> >> But I'm not sure about this, so don't cite me. :)
> > >> >>
> > >> >>
> > >> >> At 16:43 23.12. 2000, Kraa de Simon wrote the following:
> > >> >> --------------------------------------------------------------
> > >> >> >But I can use the pdf_* functions _without_ installing
> > >> >> additional products
> > >> >> >like pdflib?
> > >> >> >
> > >> >> >When I use pdf_open() is a new PDF file opened in Acrobat or
> > >> something???
> > >> >> >
> > >> >> >Huh???
> > >> >> >
> > >> >> >> -----Original Message-----
> > >> >> >> From: Cynic [mailto:cynic@mail.cz]
> > >> >> >> Sent: zaterdag 23 december 2000 16:38
> > >> >> >> To: Kraa de Simon; Php-General (E-mail)
> > >> >> >> Subject: Re: [PHP] Printing on a local printer
> > >> >> >>
> > >> >> >>
> > >> >> >> I reckon your hair will turn white on this, unless you use
> > >> >> >> PDFLib (or the other one) to generate the files. And it might
> > >> >> >> even then.
> > >> >> >>
> > >> >> >>
> > >> >> >> At 16:22 23.12. 2000, Kraa de Simon wrote the following:
> > >> >> >>
> > --------------------------------------------------------------
> > >> >> >> >Hi,
> > >> >> >> >
> > >> >> >> >A customer wants data from an html form printed on
> > a local printer.
> > >> >> >> >
> > >> >> >> >We are talking about pre-printed forms; so only data like
> > >> >> >> name, address,
> > >> >> >> >price must be send to the printer.
> > >> >> >> >
> > >> >> >> >How could/should I handle this using PHP?
> > >> >> >> >
> > >> >> >> >I can't think of anything else of displaying the
> > >> >> >> >fields on
> > >> >> >> the screen in the
> > >> >> >> >right positions and use browser capabilities to
> > print the screen?
> > >> >> >> >
> > >> >> >> >But than I'm sure I will have problems with
> > >> >> >> >offset/layout of
> > >> >> >> the fields and
> > >> >> >> >I don't like this solution.
> > >> >> >> >
> > >> >> >> >Any advice/help will be appreciated!
> > >> >> >> >
> > >> >> >> >Simon.
> > >> >> >> >
> > >> >> >> >--
> > >> >> >> >PHP General Mailing List (http://www.php.net/)
> > >> >> >> >To unsubscribe, e-mail:
> > php-general-unsubscribe@lists.php.net
> > >> >> >> >For additional commands, e-mail:
> > php-general-help@lists.php.net
> > >> >> >> >To contact the list administrators, e-mail:
> > >> >> >> php-list-admin@lists.php.net
> > >> >> >> ------end of quote------
> > >> >> >>
> > >> >> >>
> > >> >> >>
> > >> >> >> ____________________________________________________________
> > >> >> >> Cynic:
> > >> >> >>
> > >> >> >> A member of a group of ancient Greek philosophers who taught
> > >> >> >> that virtue constitutes happiness and that self control is
> > >> >> >> the essential part of virtue.
> > >> >> >>
> > >> >> >> cynic@mail.cz
> > >> >> >>
> > >> >> >>
> > >> >> >>
> > >> >> >> --
> > >> >> >> PHP General Mailing List (http://www.php.net/)
> > >> >> >> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > >> >> >> For additional commands, e-mail:
> > php-general-help@lists.php.net
> > >> >> >> To contact the list administrators, e-mail:
> > >> >> >> php-list-admin@lists.php.net
> > >> >> >>
> > >> >> ------end of quote------
> > >> >>
> > >> >>
> > >> >>
> > >> >> ____________________________________________________________
> > >> >> Cynic:
> > >> >>
> > >> >> A member of a group of ancient Greek philosophers who taught
> > >> >> that virtue constitutes happiness and that self control is
> > >> >> the essential part of virtue.
> > >> >>
> > >> >> cynic@mail.cz
> > >> >>
> > >> >>
> > >> >>
> > >> >> --
> > >> >> PHP General Mailing List (http://www.php.net/)
> > >> >> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > >> >> For additional commands, e-mail: php-general-help@lists.php.net
> > >> >> To contact the list administrators, e-mail:
> > >> php-list-admin@lists.php.net
> > >> ------end of quote------
> > >>
> > >>
> > >>
> > >> ____________________________________________________________
> > >> Cynic:
> > >>
> > >> A member of a group of ancient Greek philosophers who taught
> > >> that virtue constitutes happiness and that self control is
> > >> the essential part of virtue.
> > >>
> > >> cynic@mail.cz
> > >>
> > >>
> > >>
> > >> --
> > >> PHP General Mailing List (http://www.php.net/)
> > >> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > >> For additional commands, e-mail: php-general-help@lists.php.net
> > >> To contact the list administrators, e-mail:
> > php-list-admin@lists.php.net
> > ------end of quote------
> >
> >
> >
> > ____________________________________________________________
> > Cynic:
> >
> > A member of a group of ancient Greek philosophers who taught
> > that virtue constitutes happiness and that self control is
> > the essential part of virtue.
> >
> > cynic@mail.cz
> >
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>