Related Content
Generating Colour Palettes From Images In PHP
A common web design pattern is to incorporate an image into the design of the page. This creates a tighter integration with the image and the rest of the page.
The main issue in designing a page around the image is that the colours of the page must match the image. Otherwise this creates a dissonance between the image and the styles of the site.
Validating XML Files With XML Schema Definitions In PHP
XML is a useful format for configuration, data storage, and transmitting data from one system to another. As a human readable format that can be easily read by machines it quickly gained favor in lots of different systems as a mechanism for data storage.
Creating A Character Bitmap In PHP
I was watching a video from NDC by Dylan Beattie the other day on The Story of Typography and a particular section stood out to me.
Approximating Pi Using A Circle And A Square
Pi day was a few weeks ago, but I came across this simple approximation of pi recently and decided to put together an example in PHP since it seemed pretty simple.
This approximation of pi centers around a real world example, but we can simulate this using some code.
Drawing A Parabolic Curve With Straight Lines In PHP
A parabolic curve is a type of curve where every point is an equal distance from a focal point. There a number of different way to generate this sort of curve using math, but one of the simplest is to use straight lines to create the illusion of the curve.
Recreating Spotify Wrapped In PHP
I quite like the end of the year report from Spotify that they call "Wrapped". This is a little application in which they tell you what your favorite artist was and what sort of genres you listened to the most during the year.
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 giHlZp8M8D on Thu, 10/08/2015 - 15:03
PermalinkSubmitted by lawrence on Thu, 10/08/2015 - 16:39
PermalinkSubmitted by giHlZp8M8D 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 giHlZp8M8D 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 giHlZp8M8D on Sat, 12/26/2020 - 13:48
PermalinkAdd new comment