Wednesday, August 5, 2020

GSoC 2020 Project Report

Index

Introduction

This post is about the project done during the Google Summer of Code 2020, under the mentorship of The Linux Foundation.

About Me

I am Vikrant Malik, a pre-final year student of Indian Institute of Technology, Kanpur. This has been my first time participation in the Google Summer of Code Programme.

Mentors

  1. Sahil Arora: Sahil is an alumnus of IIT Mandi. He has made great contributions to The Linux Foundations and was part of GSoC 17 and 18 under The Linux Foundation and has extensively worked on bannnertopdf and PCLm support for cups-filters. He is currently Analyst at Goldman Sachs.                                                                                                       Contact: sahilarora [dot] 535 [at] gmail [dot] com.                                                                     Githubhttps://github.com/sahilarora535.
  2. Till Kamppeter: Till Kamppeter is the project leader for OpenPrinting. With OpenPrinting, he leads the development of new printing architectures, technologies, printing infrastructure, and interface standards for Linux and Unix-style operating systems. For this he is in contact with the leading printer manufacturers, all relevant free software projects, and the distribution vendors. Till is also a distinguished Linux Foundation Fellow.                                 Contact: till [dot] kamppeter [at] gmail [dot] com.                                                                  Githubhttps://github.com/tillkamppeter 

Acknowledgements

I would like to express my sincere vote of thanks to my mentors, Sahil and Till, for being extremely supportive throughout the project. I would like to express my gratitude to Aveek Basu (basu [dot] aveek [at] gmail [dot] com), who found me this year during the Google Summer of Code selections, and for selecting me to contribute to such great projects.

About CUPS and CUPS-FILTERS

CUPS is the standards-based, open source printing system developed by Apple Inc. for macOS® and other UNIX®-like operating systems. CUPS uses the Internet Printing Protocol (IPP) to support printing to local and network printers. CUPS is the primary printing software. CUPS-FILTERS is a software which is shipped with CUPS on non-MAC-OS operating systems and is mainly responsible for, as the name suggests, filtering the data that goes to the printer, for example converting the print file to a format supported by the printer, getting IPP attributes from the printer, etc.

The Project

Problem

Previously, if an incoming print job was a PDF file and the printer is not a PDF printer, the file would be rasterised and then converted to PWG/CUPS Raster. This was needed if the file contained vector graphics, etc. but was unneeded and even produced bad interferences if each page was simply a full-page bitmap (raster graphics).
Also, the resolution of the output CUPS/PWG Raster used to be different from the original raw raster data in the PDF/PCLm files, due to the rasterisation which took place in the poppler or other APIs. This also increased the size and the processing time of the CUPS/PWG raster data if the resolution was much higher of the output raster as compared to the raw raster data of the PDF/PCLm file.

The new pclmtoraster filter added to the cups-filters project extracts raw raster data from PDF files with 1 bitmap per page and PCLm files. The test reports can be found here.
It extracts the raster data line by line using the QPDF API and stores it temporarily. After extracting the raster data from the raster only file, it changes the colorspace and bits per pixel of the extracted data if required. It currently supports all PCLm files as well as PDF files which have 1 bitmap per page with 8 bits per component and either of the following colorspaces: DeviceRGB, DeviceGray, DeviceCMYK.
After the implementation of the pclmtoraster filter was complete, it was converted to a filter function so that it can be used in Printer Applications.

Firstly, it took me a lot of time to understand the huge codebase. Then when I was almost complete, I realized there were color spaces issues which lead to segmentation faults. Also, there were issues relating to page size rendering and margins.

Code Links

All of my work was merged into the cups-filters GitHub repository. The following was the work done as part of GSoC 2020 project:
  1. https://github.com/OpenPrinting/cups-filters/pull/264
  2. https://github.com/OpenPrinting/cups-filters/pull/257
  3. https://github.com/OpenPrinting/cups-filters/pull/243
  4. https://github.com/OpenPrinting/cups-filters/pull/271
  5. https://github.com/OpenPrinting/cups-filters/pull/275

Footnotes

cups-filters

cups-filters got split out of CUPS for CUPS version 1.6.x, containing the filters and backends which Apple does not need for Mac OS X and therefore did not want to maintain anymore. Till Kamppeter had overtaken this part as an OpenPrinting project named cups-filters. He added cups-browsed as CUPS itself did not automatically make remote CUPS queues available locally anymore. He also took maintainership on all CUPS features which Apple has given up. With the time, cups-filters got improved cups-filters, especially switched to a PDF-based printing workflow, added legacy CUPS broadcasting/browsing, sophisticated filtering of remote printers, auto setup of remote IPP printers, driverless printing, etc., and all the time kept it compatible with new CUPS features.

GSoC 2020 Project Report

Index Introduction About Me Mentors Acknowledgements About CUPS and CUPS-FILTERS The Project P...