GSoC 2021 Final Work Product — The Linux Foundation: Remove dependency of PPD files from common UNIX printing system.
Introduction
Aim of the project:
To make printing work through CUPS(common unix printing system) without the support of PPD(postscript printer description) file. Please note that we don’t have to remove support for PPD files altogether (cause legacy printers still exist and they do not support IPP), but we have to add functionalities in CUPS filters such that IPP printers need not to create PPD files for printing stuff.
Project details:
Organisation: The Linux Foundation
Source code: OpenPrinting
Project URL : click here
Student : Suraj Kulriya
Technologies: C, CPP, IPP, CUPS
Background of the project:
Basically, there are some problems attached with PPD files.
- Sometimes a user downloads a wrong PPD file from the internet and messes up in printing.
- Few years ago, Michael Sweet deprecated use of PPD files when we switched to PDF-centric workflow but due to lack of replacement we have continued using them.
- With no more use of obsolete PPD files, we can make system more sandboxed where applications are completely isolated from each other having their own file system and well-defined paths for communicating to each other.
Hence, to make the system more efficient and stable, we need to support printing without the help of PPD files.
Approach for the project:
To understand this, we first need to know what does a PPD file do. Basically, a PPD file is used to get info about printer capabilities like default margins, if the printer is a color-printer, if the printer support duplex printing, supported fonts, supported PDLs(page descriptive languages) so on and so forth. So, if we can somehow get these printer properties from the printer itself instead of a PPD file, then we are done. Here printer IPP attributes come to the rescue. Although IPP attributes are supported only by IPP printers and not by legacy printers so if IPP attributes are not there we make use of PPD file and if later too is not there we try to use some default values for these capabilities that are most likely to be supported by many printers(democratic system :).
Work done:
Here is the link for all the pull requests that I made during my GSoC coding period. Please note that all these PR(s) got merged except the 13th(2nd last) and 14th (last). These PRs are still open and will probably be merged sooner or later.
- Added support of printer and job IPP attributes in pdftoraster filter
- Defined functions ippRasterMatchIPPSize() and getBackSideAndHeaderDuplex() and added support of printer and job IPP attributes in pclmtoraster filter function.
- Added support of printer and job IPP attributes in pdftopdf() filter function.
- Added support of printer and job IPP attributes in imagetopdf() filter function.
- Added support of printer and job IPP attributes in imagetoraster() filter function.
- Memory leak fixed in imagetoraster() filter function.
- Double free in imagetoraster() filter function fixed.
- Added support of printer and job IPP attributes in pdftops() filter function.
- Silenced compiler warnings in pdftops() filter function.
- Added support of printer and job IPP attributes in texttotext() filter function.
- Defined function joinJobAttributesAndOptions() and added support of printer and job IPP attributes in Ghostscript() filter function.
- Added support of printer and job IPP attributes in rastertopdf() and rastertopclm() filter function.
- print-render-support added in Ghostscript and imagetoraster filter function.
- Added support of printer and job IPP attributes in bannertopdf() filter function.
Here are some of my contributions that I made in pre-GSoC period, the phase when I was learning the basics of the codebase:
- Fixed gs command line for counting pages as it takes too long on PDF files converted from DjVu files.
- Margins updated in texttopdf filter function when no PPD file is used.
- Added cups package configuration file.
- Default browsing is made dependent on the user’s choice.
- Made true case insensitive for certain options in PPD file and corrected documentation for existing clients.
- Added cupsfilter error messages to help users to know what’s the problem occurring.
Status of the project:
So, all the filter functions have already been fully worked upon and tested except for few filter functions(like pstops) that are explicitly made for postscript printers. Since postscript printers always come with a PPD file and in future too, if a new printer is released it will come with a PPD file so we don’t have to worry about such printers and filter functions like pstops. Some other filter functions like commandtoescpx and commandtopclx too are not to be worried about since they are never practically used. Other filter functions have already been fully worked upon and tested.
Experience:
I have learned a lot during the GSOC period and the code speaks for itself. With several PRs merged and several approaches discussed, I think that I have become a better developer and a team worker.
I communicated with my mentors and met amazing people along the way and learned amazing stuff from them.
C, CPP, makefiles and GNU autotools had excellent documentation and all the features that I implemented taught me a new concept.
This GSoC with OpenPrinting was an enjoyable experience. The mentors I have been assigned with were very friendly, helpful, and supportive. The community as a whole is fabulous and enthusiastic.
The coding experience was enlightening. I have learned a lot of best practices in coding and Open Source. The work was always enjoyable and insightful. Mentors were very generous in explaining why I should be doing things in a particular way. The Overall experience was just awesome. The mentors were very knowledgeable. I don’t have words to portray how fantastic they were.
Acknowledgement :
I am very thankful to my mentor Till Kamppeter sir. Without him, the work never would have been this joyful and rewarding. He was always available to answer my questions on time and also actively ensured that my Pull Requests were reviewed and that the coding standards were up to the mark. He also provided appropriate links to resources and made sure that the deadlines were met through regular meets. I love the OpenPrinting community for its welcoming and enthusiastic nature.
I also want to thank Sahil Arora sir, Piyush Goyal, Aveek Basu sir and Dheeraj Yadav sir for always supporting me throughout the programme.
Finally, thanks to the GSoC program, without which, I wouldn’t be a part of this awesome project and gain this memorable experience. I am thankful to them for creating this kind of opportunity for students.