send a PDF file to a printer from PHP
Posted by: mfran2002 (---.ip13.fastwebnet.it)
Date: February 27, 2013 03:54PM

hello
I need to print a PDF file from PHP

I thought to use one of the following functions:

exec, system, shell_exec

to launch the print command, but I'm becoming crazy....

I tried with 'lpr' but it prints only text, not PDF...

can you help me?

thanks

Options: ReplyQuote
Re: send a PDF file to a printer from PHP
Posted by: RiggsFolly (---.ppp.as43234.net)
Date: February 27, 2013 05:26PM

Are you trying to do this from the browser or a CLI script.

None of the options you have looked like are runable from the browser and at best would cause the print to happen on the server and not the users browser and therefore the users system.

If you provide a link to a .pdf when the uer clicks it and shows the pdf in the browser there should be a print option on the pdf menu bar.



You may need to be more specific about what you are doing !!!!

Options: ReplyQuote
Re: send a PDF file to a printer from PHP
Posted by: mfran2002 (---.ip13.fastwebnet.it)
Date: February 27, 2013 05:53PM

Ok, thanks,
I will try to be more specific

it is a web application, using WAMP

this is the command I try to use:

system('AcroRd32.exe /t "myfile.pdf" \\myprinter');

Options: ReplyQuote
Re: send a PDF file to a printer from PHP
Posted by: stevenmartin99 (Moderator)
Date: February 27, 2013 06:19PM

YOU NEED TO READ PEOPLES POSTS AND RESPOND TO THEM!!

otherwise i will just delete the thread.


Once Again....


Are you trying to just print locally on the PC running Wamp or what???????

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: send a PDF file to a printer from PHP
Posted by: RiggsFolly (---.ppp.as43234.net)
Date: February 27, 2013 08:40PM

system() is a PHP command. PHP runs on the server ( NOT THE BROWSER )

If that were to work it, which I doubt, all it would do is print the file on the server.

Are you prepared to post peoples prints all over the world?? Or do you want to send a pdf file to the browser for the site user to print on their own printer.

Options: ReplyQuote
Re: send a PDF file to a printer from PHP
Posted by: mfran2002 (---.21-151.libero.it)
Date: February 27, 2013 09:47PM

sorry for my replies, I'm a principiant

1. the client runs the web application on the same pc on which wamp is installed
2. he open the browser and launch the php application
3. he fill in a form and then the php application create a pdf file saving it into the local file system
4. then the application should send this file to a local network printer (network printer or maybe usb connected printer)

so, after the pdf file creation I need to send it to the printer

I thought to the folllowing ways:

system('AcroRd32.exe /t "myfile.pdf" \\myprinter');

or

to launch a print command like lpr or print....

but, in the first case nothing happen (it runs from DOS but not from PHP), only I see the AcroRd32.exe task in the task manager

in the second case I do not find the correct command to print a PDF (only text file or other....)

sorry for my previous posts
thanks

Options: ReplyQuote
Re: send a PDF file to a printer from PHP
Posted by: stevenmartin99 (Moderator)
Date: February 27, 2013 09:55PM

This is a bad way to do this. Set up a print spooler that prints any file that gets created in a folder and have php just save the file to the folder.

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]



Edited 1 time(s). Last edit at 02/27/2013 09:56PM by stevenmartin99.

Options: ReplyQuote
Re: send a PDF file to a printer from PHP
Posted by: mfran2002 (---.ip13.fastwebnet.it)
Date: February 28, 2013 08:34AM

Thanks for your suggestion
Can you please give some info how can I set up a print spooler? I do not know anything about it....

thanks again for you help

Options: ReplyQuote


Sorry, only registered users may post in this forum.