Related Content
A Look At Flood Fill Algorithms In PHP
If you have ever used a paint program then you might have used a flood fill algorithm. This is a mechanism by which an area of an image can be filled with a different colour and is normally depicted by a pain can pouring paint.
A Look At Benford's Law
Benford's Law is an interesting heuristic in data analysis. It states that in any large collection of numbers that are created naturally, you should expect to see numbers starting with the number 1 about 30% of the time. The frequency distribution of numbers states that 2 should appear about 17% of the time, down to 9 being seen just 5% of the time.
Protecting A Page From Being Directly Accessed With PHP
I was thinking recently about the number of ways in which I could restrict access to a page using PHP.
The obvious option is to create a user authentication system, but in some situations that is overkill for what is required. If you just want to prevent users from going directly to a certain page then there are a few options open to you.
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.
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