Related Content
Creating An Authentication System With PHP and MariaDB
Using frameworks to handle the authentication of your PHP application is perfectly fine to do, and normally encouraged. They abstract away all of the complexity of managing users and sessions that need to work in order to allow your application to function.
Creating Sparklines In PHP
A sparkline is a very small line graph that is intended to convey some simple information, usually in terms of a numeric value over time. They tend to lack axes or other labels and are added to information readouts in order to expand on numbers in order to give them more context.
PHP:CSI - Improving Bad PHP Logging Code
I read The Daily WTF every now and then and one story about bad logging code in PHP stood out to me. The post looked at some PHP code that was created to log a string to a file, but would have progressively slowed down the application every time a log was generated.
Generating Histogram Colour Analysis Graphs From Images In PHP
If you've ever looked at the settings in a digital camera, or have experience with image processing programs like GIMP, then you may have seen a colour histogram. This is a simple graph that shows the amount of different shades of colour are present in the image.
PHP:CSI - To Switch, Or Not To Switch?
I was writing unit tests for a API mapping function recently and came across this interesting issue. The code I was writing tests for was in a legacy codebase that I was making changes to, and it made sense to have some unit tests in there before I started work to ensure everything worked before and after.
Drupal 9: Generating Header Images For Pages Of Content Using PHP
Embedding image within pages of content helps both within the design of the page and when shared on social media. If you set up meta tags to point at a particular image then that image will appear when the page is shared on social media. This makes your page stand out more.
Comments
Submitted by Bart on Sat, 10/30/2010 - 18:55
PermalinkSubmitted by me 2 on Mon, 05/14/2012 - 06:59
PermalinkSubmitted by me 2 on Mon, 05/14/2012 - 07:01
PermalinkSubmitted by Saint-Cyr on Sat, 07/18/2015 - 08:46
PermalinkSubmitted by Lawrence on Thu, 10/08/2015 - 14:51
PermalinkSubmitted by philipnorton42 on Thu, 10/08/2015 - 15:03
PermalinkSubmitted by lawrence on Thu, 10/08/2015 - 16:39
PermalinkSubmitted by philipnorton42 on Thu, 10/08/2015 - 17:19
PermalinkSubmitted by Tom on Thu, 11/19/2015 - 12:25
PermalinkSubmitted by Amir on Mon, 06/20/2016 - 21:07
Permalinkshell_exec('lpr file.txt');
Might be worth a shot?Submitted by philipnorton42 on Tue, 06/21/2016 - 10:51
PermalinkSubmitted by ken chandara on Tue, 07/19/2016 - 04:50
PermalinkSubmitted by Philip Okugbe on Tue, 08/23/2016 - 19:53
PermalinkSubmitted by Pradeep Chavan on Sat, 04/01/2017 - 14:44
PermalinkPrinting directly From PHP make is possible to let the user print a document on his own printer. But PHP is completely server-side. So this would mean using the printer-functions, you can only print on devices connecting to the server.
Submitted by Jhonmilton on Fri, 08/10/2018 - 11:33
PermalinkAre you really serious?
Your code is nice and only meant for the developer.
How do you expect me to know the names of the all the printers for all the clients that use my app?
If there was another way, I could eh.., have my clients input or select their printer from the list of printers they have on their machines, then pass that value to the php.ini file, that would be fine.
Meanwhile, even with that, writing a code to draw-text and draw lines for every bit of row and column to be printed, is far-too-cumbersome.
Where does the CSS styling come in?
Thank you
Submitted by Anonymous on Sat, 12/26/2020 - 10:41
Permalink> Are you really serious?
Well, yes. I mean I used it for a while back in 2009. Haven't really had the need to use it since then though. I think the package has been made largely redundant for a good while now, not even sure it will work with PHP8. Since this is Windows only I haven't had any way of running this code for at least 8 years.
> Your code is nice and only meant for the developer.
Yes. It is only meant for the developer. Sorry if this isn't clear.
> How do you expect me to know the names of the all the printers for all the clients that use my app?
I think you might be mistaken. Since PHP is a server side language you should absolutely know what printer you are going to print to as it will be connected to your server.
> If there was another way, I could eh.., have my clients input or select their printer from the list of printers they have on their machines, then pass that value to the php.ini file, that would be fine.
You could allow your users to select from a list of printers, but the printer would need to be available from the server you are running your PHP on. If the printer is connected to the server via a network then you could potentially use printer_open() with the name of the printer you are trying to open as the paramter.
> Meanwhile, even with that, writing a code to draw-text and draw lines for every bit of row and column to be printed, is far-too-cumbersome.
True, but if you are printing something simple like a shopping receipt then this would be ideal.
> Where does the CSS styling come in?
Well, it doesn't as CSS is never interpreted by PHP to render the printer output. It sounds like you are trying to print from a browser, in which case this code would never be run as it would be the browser doing the printing.
Submitted by philipnorton42 on Sat, 12/26/2020 - 13:48
PermalinkAdd new comment