473,408 Members | 2,477 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Printer function

Hello,

I tried to find out how can I print a document through php. What I want,
is to add a "print button" within a web page (something like the "Print"
button of the explorer, but within the page).
I tried a little bit with the printer_open() function of php but with no
luck. I red the docs, but I couldn't understand which functions are
required to print.

printer_open();
.... what else ???
printer_close();

Thanks a lot!

Fotis.
Jul 17 '05 #1
8 2993

"Fotis Andritsopoulos" <fa*****@telecom.ntua.gr> wrote in message
news:42************@telecom.ntua.gr...
: Hello,
:
: I tried to find out how can I print a document through php. What I want,
: is to add a "print button" within a web page (something like the "Print"
: button of the explorer, but within the page).
: I tried a little bit with the printer_open() function of php but with no
: luck. I red the docs, but I couldn't understand which functions are
: required to print.

P.S. It's nicer to cross-post (a bit like "CC:" in email) to multiple
groups, so that all the replies stay in the same place and nobody flames you
for asking the same question multiple times...

Matt
Jul 17 '05 #2
I noticed that Message-ID: <42************@telecom.ntua.gr> from Fotis
Andritsopoulos contained the following:

I tried to find out how can I print a document through php. What I want,
is to add a "print button" within a web page (something like the "Print"
button of the explorer, but within the page).


What good would it do to print a document from the server? Maybe you
could get the ISP to post it to you... ;-)
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #3
Look, I have a client-server application that displays some results
(formed by php) and

1) I want to print these data.
2) I don't want to use the "Print" button of the browser.
3) I don't want to use javascript.

The client and the server own to me (not to the ISP) :)
What good would it do to print a document from the server? Maybe you
could get the ISP to post it to you... ;-)

^^^^^^^^^
Funny ?

Fotis.

Jul 17 '05 #4

"Fotis Andritsopoulos" <fa*****@telecom.ntua.gr> wrote in message
news:cv**********@ulysses.noc.ntua.gr...
: > What good would it do to print a document from the server? Maybe you
: > could get the ISP to post it to you... ;-)
: ^^^^^^^^^
: Funny ?
:
: Fotis.

Well, I for one nearly died laughing!

Matt


Jul 17 '05 #5
Fotis Andritsopoulos wrote:
Look, I have a client-server application that displays some results
(formed by php) and

1) I want to print these data.
2) I don't want to use the "Print" button of the browser.
3) I don't want to use javascript.

The client and the server own to me (not to the ISP) :)


If you're on Linux you could just use system() to send it to lpr or whatever
your preferred print tool is. But what do you intend to use to format the
result into nice pages?
What good would it do to print a document from the server? Maybe you
could get the ISP to post it to you... ;-)

^^^^^^^^^
Funny ?


It was supposed to be, and I laughed. Most people on this newsgroup are
probably thinking that what you're trying to do is broken by design.

--
The email address used to post is a spam pit. Contact me at
http://www.derekfountain.org : <a
href="http://www.derekfountain.org/">Derek Fountain</a>
Jul 17 '05 #6
Fotis Andritsopoulos <fa*****@telecom.ntua.gr> wrote in
news:42************@telecom.ntua.gr:
Hello,

I tried to find out how can I print a document through php. What I want,
is to add a "print button" within a web page (something like the "Print"
button of the explorer, but within the page).
I tried a little bit with the printer_open() function of php but with no
luck. I red the docs, but I couldn't understand which functions are
required to print.

printer_open();
... what else ???
printer_close();

Thanks a lot!

Fotis.


The "printer" family of functions is normally used to write to the local
printer attached to the server running PHP or to a network print device.
If that works for you (ie, the server is physically located at your
facility), then you can use these functions. Keep in mind this will only
work if the server running PHP is a windows machine.

A better solution might be to use a PDF library (http://www.ros.co.nz/pdf).
When you click the "print button" on your page, you'll launch a script that
creates the PDF and displays it in, maybe, a new browser window using
Adobe Acrobat on the client's machine. There are many examples available.
I believe this project has been moved to sourceforge where there are Q&A
forums available.

Jul 17 '05 #7
Fotis Andritsopoulos wrote:
Look, I have a client-server application that displays some results
(formed by php) and

1) I want to print these data.
2) I don't want to use the "Print" button of the browser.
3) I don't want to use javascript.


So you have a problem.

Printing is client side, unless you want to print from your server box (as
already stated by others). PHP is server side. You need a client side
solution. The print button is client side, Javascript is client side. If you
don't want to use them you need to re-invent the wheel.
What good would it do to print a document from the server? Maybe you
could get the ISP to post it to you... ;-)

^^^^^^^^^
Funny ?


In most cases if people give you funny answers they actually try to point
you to something that should be obvious. Try to see the helping aspect in
it, instead of getting angry.

--
Markus
Jul 17 '05 #8
Markus Ernst wrote:
Fotis Andritsopoulos wrote:

Printing is client side, unless you want to print from your server box (as
already stated by others). PHP is server side. You need a client side What I'm thinking is to prepare a php script that connects to the
server's shared printer (php is running on server) and to send the data
to print through printer_open() etc. A possible way I found so far is to
build a .pdf document (through the "pdf capcabilities" of php) in order
to print. Is it possible to send plain text and not a .pdf document ?

Thanks,

Fotis.

What good would it do to print a document from the server? Maybe you
could get the ISP to post it to you... ;-)


^^^^^^^^^
Funny ?

In most cases if people give you funny answers they actually try to point
you to something that should be obvious. Try to see the helping aspect in
it, instead of getting angry.

Jul 17 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Hank | last post by:
My Access 2000 code has been running for several years in our main plant. Now we need to install it, as a stand-along application, at remote sites, some of which are out of state. My problem is...
6
by: Ioannis Demetriades | last post by:
Hi, I need to change the printer's font to "control" -a printer font, and then send a sequence of characters to the printer. My problem is that I cannot change the printer's font. Can this be...
11
by: pamelafluente | last post by:
I am doing my own PrintDialog, and have placed there a combo with the printer names, as in the PrintDialog provided by VB.NET. Here is the question: how do I open the native windows printer...
4
by: Paul H | last post by:
OK, I tried getting and old Newbury Data ND2500 working using the "Generic /Text only" driver in Win XP. It prints, but I could not find a way to set a custom page size that matches the paper I am...
13
by: Susan Beebe | last post by:
I have downloaded the code described in Microsoft article Q154078. I am trying to send raw ZPL (zebra barcode printer) code from Microsoft access. It works just fine if I hard code the actual...
1
by: sathyp | last post by:
Public Function SetPrinterDefaultsW(ByVal sPrinterName As String, _ ByVal nPaperSize As Long, ByVal nOrientation As Long) As Boolean Dim Prn As Printer Dim hPrinter As Long Dim pd As...
5
by: Raman | last post by:
Hello friends, I want to print an ID card. I have one Windows Form that contains front and back side. The printer is printing both front and back side at a time. I am trying to send both sides...
2
sashi
by: sashi | last post by:
Set default printer You will often find yourself in a position where you have designed a report format for one printer and when that report is sent to another printer the layout is messed up. ...
9
by: id10t error | last post by:
Hello, I am going to be using a Symbol WT4090 to scan items. I need to printer a tag from the Zebra ql320 plus. I am trying to do this is Visual basic 2005. Does anyone know and good site to...
2
by: Flying Kite | last post by:
Hi All, I want to know how to print chinese characters on Zebra Printer, following code working fine with English string, but it's not working for Chinese string. It shows ASCII characters instead...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.