Gutenprint is a suite of printer drivers that can be used with UNIX and Linux print spooling systems, such as CUPS (Common UNIX Printing System), lpr, LPRng, and others. Gutenprint currently supports over 700 printer models. Gutenprint was recently ported to Haiku, both increasing its printing capabilities, as well as extending its supported printer models. This article describes Gutenprint and the effort to port it to Haiku.
Extending the Haiku printer driver framework
Libprint, the printer driver framework, is used by native printer drivers such as
Canon LIPS 3 and 4, HP PCL5 and PCL6, and Adobe PostScript. Exceptions are the Preview and
the PDF printer driver.
This framework makes it very easy to add a new printer driver to Haiku. It provides the
user interface for the page setup dialog, the print job setup dialog and a preview window.
It performs the rendering of the page as a sequence of bitmap bands. The printer
driver then converts the bitmap bands to a stream of data in a format that is understood
by each printer.
The setup dialogs provide a fixed set of settings whose value ranges are configurable
to match specific printer drivers. For example whether a printer is a color printer and the available
paper sizes (Letter, A4, …).
The page setup dialog in Figure 1 shows the values for paper size and resolution from Gutenprint.
Figure 1: Page Setup Dialog
Gutenprint contains a meta model for the available settings of a printer model. Some of these
settings can be mapped to existing settings provided by libprint. For the missing settings
libprint had to be extended to show them in the job setup dialog and to persist them in the
job settings.
Now libprint supports the following type of settings: A list of values visualized as
a combo box, a boolean flag visualized as a check box and a value in a range of values
visualized as a slider.
Figure 2 shows the job setup dialog. The settings inside the red rectangle are the missing settings
from Gutenprint.
Gutenprint categorizes settings from basic to advanced. In the printer driver only the basic
settings are enabled. When the advanced settings are enabled there are so many that the
setup dialog would get too large to fit on most screens because of a
in the Layout API. As soon as this bug is fixed the advanced settings can be enabled.
Porting Gutenprint
Gutenprint consists at least of the core library, a GTK user interface, and support for CUPS, foomatic,
GIMP and Ghostscript.
For the printer driver, only the core library is required. The Gutenprint core library provides an API to
query the available printer models, to query and modify the printer model specific settings, and to
convert an image on a page into a stream of printer specific data.
Porting Gutenprint to Haiku was relatively easy. The core built without any problems with both GCC2 and GCC4
once the configuration files had been created.
Gutenprint uses the “configure”
script to support building on different platforms and in differnt configurations
but the script does not support Haiku yet.
So building on Haiku did not work at first. Since I did not have the knowledge of how to get the configure
script working on Haiku, and I did not want to waste too much time in getting it to build,
I decided to first try to build Gutenprint on OpenSuSE. There was no problem with that build. The
configure script generated header and make files. In the header files macros are used for the
configuration of the Gutenprint build.
After adapting the header files for Haiku and creating Jamfiles, the port was completed!
At runtime Gutenprint needs some data files that are part of Gutenprint source code repository.
When the Haiku image is created these data files needed to be copied to the image as well.
For example the list of printer models is stored in an XML file printers.xml
.
Writing the printer driver
Since I had written native Haiku printer drivers
using libprint in the past I am familiar with the
printer driver framework. The driver was implemented step by step.
After each step the added functionality could be tested. The steps outlined here might not be
in chronological order.
I started with a printer driver skeleton by copying an existing driver
and the removing the printer driver specific source code. The driver could be built soon but
did not generate any output yet.
First the printer model selection dialog was implemented. Thanks
to Ithamar R. Adema who implemented such a dialog for the PostScript driver, the user interface
was already available as depicted in figure 3.
Only the printer manufacturer and model had to be obtained from Gutenprint.
Figure 3: Printer Model Selection Dialog.
Then the settings needed for libprint where obtained from Gutenprint.
At this point in time the other Gutenprint generic settings weren’t supported yet.
These were implemented in the last step.
At this step, the printer still did nothing. The bitmap bands for a page needed to be handed over to
Gutenprint. Figure 4 shows an illustration of an image on a page.
When all bitmap bands for a page are available Gutenprint is requested to
print an image on the page. The position and size of the image are set and then Gutenprint
uses a callback mechanism to request the size of the image in pixels and gets the
pixels for the image to be printed line by line.
The pixels are always encoded in RGB 8 bits per channel. For black and white printing
Gutenprint is responsible for doing the color conversion.
The maximum number of bytes temporarily required for a page in letter size in 300 DPI should be
about 32 MiB and for 600 DPI it should be about 128 MiB. On modern hardware that should not
be a problem.
Figure 4: The page with printable rectangle and an image enclosing the bitmap bands.
The bitmap band to Gutenprint image conversion worked on the second attempt printing a test page.
I had quite some difficulties to get the image positioning and size calculation right,
as the unit is 1/72 Inches and the internal unit is 1/dpi where dpi is the currently
selected resolution and at first I wanted it to be as exact as possible. The position and
size should be a multiple of the greatest common divisor of 72 and dpi.
However that is not always possible without truncation of the output image,
because Gutenprint does not allow to place an image outside the printable rectangle
(there is usually a margin of more or less 10/72 Inch around the paper where printing is not possible).
Now a not so accurate solution is implemented that stays within the paper margin limits,
that seems to work good enough.
During the work on the Gutenprint driver most of the printing related user interfaces were
updated to use the Layout API. This gets rid of font size sensitivity issues.
Also some bugs were fixed in the USB transport add-on and in libprint where the page contents
did not rotate printing in landscape mode.
Lines of Code
The following table shows the lines of codes in revision
39800 of the header files, source files,
their sum and the percentage of the sum to the total number of lines.
The lines of codes includes empty lines and comments.
Component | .h | .cpp | .h + .cpp | Percentage |
---|---|---|---|---|
Gutenprint (libgutenprint) | 5.720 | 45.413 | 51.133 | 77,7% |
Haiku printer driver framework (libprint) | 3.202 | 8.418 | 11.620 | 17,7% |
Haiku Gutenprint printer driver (Gutenprint) | 689 | 2.344 | 3.033 | 4,6% |
Total | 9.611 | 56.175 | 65.786 | 100% |
Table 1: Lines of Codes.
For the extension of libprint about 1538 lines were added.
Not all lines were new code because the code style in libprint was changed to conform to the
Haiku coding style.
The total number of lines increased between revision 36173
and 39800 in libprint and
Gutenprint printer driver to 4.571.
Copyright 2010 Michael Pfeiffer (a.k.a. laplace)
Lector: Andrew Hudson
This article will be also hosted at haiku-os.org
It is always great pleasure to see Haiku progressing. kudos to Haiku development team!
Ok, so, I’m having kind of a quiet night, so I download the latest Haiku nightly build and install it to my hard drive. After downloading WebPositive, I relax by checking one of my favorite websites, OSNews, and, suprise, the latest article is about printing it Haiku! So, I went ahead and tried setting up my printer.
Haiku has a gloriously simple user interface (of course) for installing printers. I select gutenprint -> Samsung -> and fail to find my printer listed. (Samsung ML-2510) I had the same problem in Linux, until I installed the drivers from the SpliX package. I just now downloaded the SpliX drivers and have the “ml2510.ppd” driver sitting on my Haiku desktop.
SO… My question is, can Haiku / gutenprint use a PPD printer driver file? If so, where shall I “install” (copy) it to?
If the PPD file won’t work, don’t worry about it.
Thank you so much!
By the way, a fabulous amount of printers seem to be supported.
I may be mistaken, but I think you’ll need Foomatic for that – which Haiku’s Gutenprint port doesn’t include.
“fabulous amount of printers seem to be supported”
Exactly seems to be… Just because your printer listed it doesn’t mean the driver will work. Actually very few of those printers supported as much as they are in windows not to mention the new 4in1 printers which prints, faxes, copies etc.
You might able to get the printing working but not the other functions and when you go to the manufacturers webpage looking for linux drivers they just throw you a link to GutenPrint and have fun…
If you are about to buy a printer for a unix only network then:
a, either buy a network printer which has its own ppd embedded in it and recognize file formats. In this case you can just ftp a pdf to the printer and its printing it.
b, Do an in depth search about the printer you about to buy is really supported don’t just read 2 googled post on linuxquestions, ubuntuforums about it.
Personally I dont give a damn about bothering with the whole *cups* silliness just install xp on a vm and set the printer up in it. It doesn’t worth the time when the printers are still on the same price then the ink cartridges. If it doesn’t work out you can throw it away and buy a new one.
Edited 2010-12-23 01:36 UTC
But you see, not everyone wants to run XP either natively or in a VM. That would be why they are running an alternative OS in the first place. Another reason would be that they cannot afford or find for purchase a copy of XP even if they did want to run it.
This quote is a perfect example of what is wrong with our culture today. I know you are speaking of trashing the VM and reinstalling, which is trivial save for the time involved. But really, it speaks of a wider philosophy of “if it’s broken, don’t fix it just throw it away and buy another”. That is anathema to my ears.
no mention about funding of the port.
Indeed. Haikuware really deserves to be mentioned for the great service that it provides to the Haiku development ecosystem through its bounties initiatives.
Believe me, I mention this not just for gratification – it’s to help publicize that there are alternative funding options for developers. I do remember OSNews publishing an article for a $2000 bounty offered for an open source Microsoft Kinect driver, and I thought, damn I wish Haikuware would get that kind of publicity. All it would take is an ounce of recognition in this article as to where the funding for the project came from. I know that the article wasn’t published on behalf of Haiku Inc. but. unfortunately, it brings up other issues. i.e It’s really discouraging to never see official recognition from Haiku (i.e the recognition they give to Google) for these bounty contributions, and really I question why I do this, and why I continue supporting Haiku through these bounties. For my time and troubles, I’ve contributed (through bounty donors) ~$12,000 to Haiku and its developers with no recognition for projects such as: the Webkit Port, SATA drivers, FreeBSD Wifi Port, Gutenprint Port, Wifi Encryption, Gnash, etc. I think Haiku Inc. could do a little better in PR to perhaps maintain good relations with the few organizations that financially support Haiku, but that’s just me!
It’s somewhat unfair to put the onus of promoting and endorsement of Haikuware on Haiku, Inc., I think. You should be lobbying the project in general for this kind of support – as it’s generally the greater body of project contributors who benefit from Haikuware’s Bounties and subsequently post updates to the haiku-os.org website (which I assume is where you want to see this promotion).
As you can see – almost everyone on the Haiku, Inc. BOD has either individually donated to Haikuware bounties, or received funding from them – so we certainly support Haikuware in this regard as individuals.
In any case, I’ve got a couple ideas that might ease your frustration – I’ll see what we can do.
The funny thing is that I visited haiku-os.org and the word “Google” appears 10 times at the front page.
I guess koki is right and what you really meant was that Haikuware’s wallet is not thick enough to be a part of your club?
Because it’s not as if Haiwkuware was a competing product/project. Its only reason to be is to promote Haiku and encourage its development (and they have made/are making some great contributions). Why wouldn’t you “promote” one of your biggest promoters (help them help you) is beyond me.
Assuming you’re not just another sock puppet…
I only suggested that the project in general is the problem, not specifically Haiku, Inc. Neither of the two Google articles currently on the front page of haiku-os.org were written by members of Haiku, Inc.
I am not banned here like I am on the Haiku mailing lists and the website that I created and you now enjoy, so I do not need to use a different nick to be able to speak my mind. Too bad you can’t censor me here, eh?
The real Koki, uncensored.
There is an explanation to this: in spite of all the sugar coating and hypocritical lip service that they have added to their repertoire over time to smooth out their image (i.e., see Urias’ response as an example), Haiku has not changed since the time you started the Haikuware bounties a few years back: it is a clique-like organization, and you are not considered part of it.
And of course Haiku’s PR sucks: they banned the best PR man they could have ever had, summary execution style and with calls of troll and even mental illness, in spite of all his contributions, including among many other things the very first Haiku Code Drive, a two week donation drive that raised US$8000 for the project.
Seriously you need to grow a pair of balls and stop bleating on about how mistreated you are.
I’m sick of reading about it.
I have transfered the money for the bounty back to Karl.
Happy holidays!
Michael Pfeiffer
Karl did hot accept it so I donated the money to the WiFi bounty.
http://haikuware.com/20101120545/gutenprint-funds-raised#comment-72…
Karl, I am sorry that you had to get it wrong, but I agree with you, Haikuware and the bounty should have been mentioned in the article. BTW when I replied to your post I didn’t know that kvdman is you.
To stop the speculations why I stepped back from the bounty, here is my explanation (maybe irrational, but that’s how I feel):
I wrote the technical report because Andrew from Haikuware asked me and I felt obliged to because of the bounty. So my decisions were still influence by the bounty. When I wrote it I did it under the premiss that it would be published on Haikuware. Later Andrew told me that it got promoted to OSnews. I had the change to mention Haikuware and the bounty, again sorry, that I didn’t do that.
What I regret is that I wrote the article in the first place, although I didn’t want to. Instead of PR for Haiku to attract attention to new users and developers, some comments show a very bad light on the Haiku community and are OT.
In order to prevent my decisions in the future be influenced by the bounty I had to give the money back, now in the form of a donation.
Whoever finishes the WiFi bounty will be happy, and I have my independence back. So it’s a win-win situation. The bounty didn’t work for me. The past has proven that it can work for others. The Gutenprint driver is still working. Only the relations in the Haiku community did not improve.
Thanks for your reply Michael. This was all just a big misunderstanding. I didn’t understand the circumstances, and probably should have just not said anything. I was just upset that after all the years of doing this, nobody bothered really to care to mention the bounties, and for some reason it came out here – which was unfortunate, and not very wise on my part. I really regret that you decided to refund the money, because you really do deserve it! Your donation to the Wifi bounty is appreciated though. I hope there’s no hard feelings, I really enjoyed communicating with you.
Everything is fine. Thank you!
Karl,
I am really sorry that you do not feel your efforts are appreciated. I think in reality they are much more appreciated than you think. For example, a couple years ago you brought it to my attention that Haikuware and the bounty program are not mentioned in Haiku’s about box. I immediately recognized this great mistake and placed a prominent notice, right besides the mentioning of the Google Summer of Code program.
Sometimes when you tried to communicate with me directly, I have encouraged you to use the proper channels. Good things did come out of it, like the “LibPak” optional meta package that Scott created which is based on your initial suggestions.
Then I know for a fact that the WiFi bounty is very much appreciated by Axel, one of our most prominent developers and also on the Haiku Inc BOD. Unfortunately he didn’t finish it 100% in time, but good things came from it and it is most certainly appreciated. Haikuware bounties do get frequently mentioned in blog posts to the main Haiku site, and those are often pushed to the front page.
I hope you can see that the appreciation is definitely there, and I hope more people in the project will give Haikuware the credit that it deserves, when they see the chance.
Seems that Gallium Port reached the target amount US$ 2.000,00.
I could buy a car with this money if I could write code..
Maybe a new entry in the right side news here in OSNews…
Edited 2010-12-28 04:23 UTC
The best would be to add a block in one or more prominent places of the Haiku website (front page, development section, etc.) with links to both the bounties main page on Haikuware and individual active bounties (ie., alternating a few active bounties in a random manner).
This would kill two birds with one stone, as it would undeniably formalize Haiku’s recognition to Karl’s effort and it would also provide the most relevant exposure possible to the bounties.
For all you people putting down the ability to print in Haiku. It’s not even at 1.0 yet. Jeez.
For the person suggesting setting up XP as a print server. Are you out of your … mind? Gross!
Some people have to print in their lives as real people with real jobs and a real life (Gross!)
And those people will be using Windows in the first place, as I don’t think there are any businesses out there using an alpha of a relatively unknown OS for day to day work.
Try again.
Businesses are reluctant to change and this essentially means Windows for a majority, OS X for a creative minority, and Linux for the rare mavericks. Haiku could attract a following in the business place for specialized uses (e.g. multimedia server?)but unlikely for the day-to-day functions.
The availability of device drivers for printers, scanners, and multi-devices for non-Windows/non-OS X operating systems will remain a stumbling block for many. Using a common/shared framework with other OSs should make it easier to have device drivers for the latest as well as legacy devices. Could be fun at home!
Well this wouldn’t happen in the first place if printers were still printers. Instead you get to buy winprinters for windows which only have drivers for windows (and sometimes not even all windows versions, M$ had to pray to the hw vendors to make drivers for win7).
If the printers you buy were to have proper PS support as real ones and open specs it would be much easier to handle and we wouldn’t need megabytes of software to send it rasterized pages or even worse head movement commands.
You’re preaching to the choir, dude. I miss the days when I could just hook my HP printer up to a parallel switch and go seamlessly from a Windows box to a Linux box without a hitch.
Printing support is nice but there are more important things waiting until haiku becomes usable: a package manager/update feature, wpa encryption and pppoe. Until then it’s just a virtual machine toy.
Edited 2010-12-23 10:02 UTC
WPA is very nearly there – http://haiku-os.org/blog/axeld/2010-12-14_almost_not_there_yet
PPPoE – I’ve not seen someone without a proper DSL router in years, seeing as most of the ancient ones don’t support the speeds being provided these days. I don’t see this actually being of much importance.
Depends on where you live. In Romania around 70% of computers are desktop not laptop so there’s no need for wifi, we use good old pppoe. I’m sure there are other countries out there in a similar position.
So true.
I have a really cheap and bad router with PPPoE support and I couldn’t get it to work faster than 300 kB/s, but if I put the cable directly in my desktop computer I got speeds of 1-3mB/s. I never looked very much into that, but I sure was glad that XP had PPPoE support.
Also, a lot of people here don’t have more than one computer, and usually it’s a desktop, so there’s no need for a router.
Edited 2010-12-23 15:09 UTC
I’m in Ireland, where the incumbent telecoms provider still seems to think its 1995 price-wise; but every package with every telco gives you a full router. It was the same in the UK when I worked for a UK telco 4 years ago.
Irrelevant as to whether the computers are desktop are laptop, routers are just easier to work with and I’d have thought they were cheap enough that they were used everywhere. Maybe not…
Whats wrong with installoptionalpackage? Just kidding, yes a package manager would certainly be nice, but it’s not essential at this stage in my opinion. An update feature on the other hand really is, dd’ing updated images isn’t exactly the smoothest of options. WPA encryption as someone else stated is coming courtesy of Axel himself, sponsored by a nice bounty from generous people over at Haikuware.
Updating… YES. YES. YES.
A working installer was requirement 1 from me to install Haiku permanently – an updater is number 2.
Congratulations to Michael Pfeiffer, aka Laplace. Thanks for a successful port of Gutenprint, and also a nice write up of the process.
With one port, Haiku now has support for 700 printers. And that is pretty cool.
And very special thanks to Karl at Haikuware.com for coordinating all the bounties for Haiku. The Haiku bounties really work, as evidenced by the all great projects that actually got done.
This ‘rift’ is overblown. The fact is that the core Haiku developers remain almost exclusively focused on Haiku operating systems issues. Haikuware is focused primarily on applications.
But special thanks are in order for Karl at Haikuware who continues to provide very important support for the Haiku ‘userland’.
You say that because you do not know the history between Haikuware and the Haiku project. This lack of recognition has happened before. When Karl tried to engage the project in the early days of his bounty initiative, he was ignored at first and then even chastised for eventually pushing his effort through on his own.
There was even some “ẗhis may be illegal” babbling from then project leader M. Phipps, which he ironically posted as an excuse on the Haiku mailing list soon after the project had taken from Karl the $2,000+ that he had raised on his first donation drive.
After that, Karl pretty much had to beg for a “thank you” post on the website, which I wrote myself and ended posting more or less against the reluctance of the Haiku admins.
I am aware of that, I read it in the old posts. And it is unfortunate. To me that is more a result of differences of opinion and naivety, rather than willful malevolence. Ultimately Karl proved his point and we are all the better for his taking action, right? Sometimes when you go against popular opinion to prove your point, people call you names in public, right? This is not junior high school anymore, so it’s important to grow a thicker skin and carry on regardless, don’t you think?
It has been my experience when dealing with the core developers that they respond to direct questions about Haiku os development, and would rather not be involved in much else. And if you think what would be the consequence of them not doing that, we would have a lot less Haiku to play with.
I do wish there was a formal ‘bridge’ in place between the core team and the apps team. Like the hotline between US and Russia 🙂
If you actually read what Phipps said about Karl’s effort here (see section towards the bottom of the message that starts with “wow”)…
http://www.freelists.org/post/haiku/Openness,13
…you will see that there is a total unwillingness to recognize that they dropped the ball and that they would not be willing to do anything else but come up with nonsensical excuses that put the accomplished contributor in a bad light.
You may want to put a positive spin to the situation, but, really, using such lame excuses to justify not supporting and eager and knowingly capable individual (Karl had already raised and donated $2K to Haiku by then) and then not showing recognition for his effort and instead chastising him does border ill will.
Sure, Karl pushed through and made the bounties program a success, and he deserves all the credit, credit that was only given reluctantly back and that still now needs to be asked for. So, history repeats itself, and another known contributor to the Haiku ecosystem feels unrecognized. The project never learns in this respect.
As I have always said, development is in very good hands for the most part at Haiku; that the core devs are mostly concerned with development and nothing else. is a good thing. But several other areas of the project (mostly those concerning the wider Haiku community beyond the core devs) suck, as they go unattended as a result or fall in the hands of people who lack the necessary time, motivation and/or skills to perform them.
Koki…
My friend… Why do we have to do this over and over? Why do you bring up my decisions from almost 4 years ago and bash the project?
I did not agree with Karl about bounties. I still don’t. I still think that donating to Haiku itself and letting them contract for completed work is a better idea than bounties.
There is nothing in that to denigrate Karl or his hard work. I respect him and his work. I don’t agree with him. I didn’t when I was in charge and I still don’t.
Now, as far as the legality and the “babble”, I find that to be pretty insulting, honestly. A bounty was created to port Java. AT THAT TIME, java was not open source, it was a copyrighted piece of software that some people had access to but NOT THE LICENSE TO PUBLISH. Therefore, a bounty for it could NOT BE LEGALLY COMPLETED. In the same way that you could sit down and translate a book into Spanish or Japanese, but you couldn’t legally publish it. That’s why I said what I did. I stand by it, too. The bounty could be argued as an inducement to commit copyright violation. At the very least, it couldn’t be legally completed. That was my point, back then. In the context of the times, it was true and made sense. It wasn’t and isn’t babble.
Look, to put this very kindly… I like you personally very much. But for whatever reason, your personality and the way that the Haiku folks do things don’t work well together. Let it go, please. You are doing more harm than good. You voluntarily left the project at least 3 times. People didn’t agree with the things you wanted to do. That’s their prerogative. You can’t force them to do what you want. When a group disagrees with one person, that person generally loses. I know that I disagreed with the admin group many times. I didn’t always “get my way”. But you learn to accept it and work toward the common goal, or you don’t. You seem to have chosen not to accept it. That’s fine, but you really can’t blame the rest of the group. Accept that there are just some people that you, personally, can’t work with. Please, let it go and move on. Let the bitterness fade. Move on. Let Haiku do its thing. If it is as bad as you say, it will fail. It doesn’t seem to be failing so far, so maybe you are wrong. I don’t know. But bashing the project only hurts everyone. Please, let it die.
Believe it or not, you friend…
OSNews (aka Thom) could create a ‘bounties’ section listing all available bounties to open source projects like Haiku..
My 0,2 cents