Jump to content

Automatic printing HTML created with php to network printer


Pearl123

Recommended Posts

Hi to all,

I am trying to create a report using php and then automatically send to network printer using default printer. I am using one library but that library does not support html page simple raw text can be printed automatically.

Any help?

Thanks

 

 

 

Link to comment
Share on other sites

42 minutes ago, Pearl123 said:

Manually print is not an issue. I would like to print automatically when the pdf is ready without click on pdf and send print command.

[Begin Architectural Sanity Check] 

Are you are doing this in a Web Application, accessed by remote Users, via a URL?
If so, you cannot do this (not with PHP).  

PHP runs on your Application server and can, therefore, only print to a printer connected to your server. 
That's not much use to a User potentially on the other side of the planet and who has no physical access to your DataCentre, which is where the printed piece of paper would wind up! 

Nor can you access any printer connected to the User's computer.  PHP has no knowledge of this. 

In short, if the User wants to print a document, then that's entirely up to them.
(These days, who's to say they even have a printer!?)

[End Architectural Sanity Check] 

 

Of course, if this is a "local" PHP [console] application that only needs to talk to your own printer, that's a whole other ball game - forget everything I said above.  
 

Regards, 
   Phill  W.

 

 

Link to comment
Share on other sites

So you finally answered my original question. 

You are saying that the php is running on your network and NOT ON A REMOTE SERVER via the internet?  Now if that is so I'm sure someone here with a little more experience using php in such a fashion may tell us how to communicate with a network device.  I have never used php 'locally' myself.

Link to comment
Share on other sites

You could try and find some PDF reader program that would let you print a PDF automatically.  On a windows machine, you could try the official Acrobat Reader and execute it with the /p /h flags:

exec("Acrobat.exe /p /h yourfile.pdf");

This is what the right click -> print option does in explorer.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.