Generally, Printer Applications as emulation of driverless IPP printers only support standard IPP job attributes as user-settable options: media size/type/source, duplex, printer-resolution, print-quality, print-content-optimize, … but some drivers, like for example Gutenprint or also PostScript printers, have many options to fine-tune the printout and those cannot get individually mapped to IPP options so that the user can control them in a print dialog. Also many print dialogs, especially of phones, are limited to standard IPP attributes.
So what we want to add is to have a preset functionality in PAPPL.
I have developed code in PAPPL to introduce preset support, which involves predefined templates for printing defaults. These presets are included in the job-presets-supported attribute of client->response.
In /pappl/printer-webif.c, I created APIs for creating, editing, copying, and deleting presets.
_papplPrinterPreset(): This function shows the homepage of the presets, allowing users to create, edit, copy, and delete presets.
_papplPrinterPresetCreate(): This function displays the web page for creating presets.
_papplPrinterPresetEdit(): This function displays the web page for editing presets.
_papplPrinterPresetCopy(): This function shows the web page for copying presets.
_papplPrinterPresetDelete(): This function displays the web page to delete a particular preset.
In /pappl/system-loadsave.c, I created an API to save presets in a file (the file is stored in /var/spool/legacy-printer-app/name_of_the_file_for_particular_preset).
papplSystemSavePreset(): This API is used to store presets in files, with each printer having a unique preset file.
In /pappl/printer.h, I created the structure of a preset represented by pappl_pr_preset_data_s, which includes fields such as:
Name: A unique name given to the preset.
Id: A unique ID assigned to the preset.
Static attributes like pappl_color_mode_t color_supported: Each static attribute has a boolean field representing whether the option is selected in the preset on the web interface or not.
After that, I wrote the code to store vendor attributes.
In /pappl/printer.c:
papplPresetAdd(): This function fetches presets from the file (stored in /var/spool/legacy-printer-app/file_name.txt).
_papplSystemAddPreset(): This function adds the preset to the running printer thread.
papplPresetDelete(): This function removes the preset element from the printer's presets array.
_papplPresetDelete(): This function removes all memory and resources associated with a particular preset.
In /pappl/printer-driver.c, I wrote the code to initialize preset fields when needed, such as during operations like edit, copy, and creation of the preset.
papplPrinterAddPresetCreate(): This function adds a particular preset to the printer thread.
papplSetPresetVendor(): This function sets vendor attributes in the preset object.
papplSetPresetFromDriver(): This function sets driver attributes in the preset object.
Please let me know what further changes I will need to make.
Thank you!
Generally, Printer Applications as emulation of driverless IPP printers only support standard IPP job attributes as user-settable options: media size/type/source, duplex, printer-resolution, print-quality, print-content-optimize, … but some drivers, like for example Gutenprint or also PostScript printers, have many options to fine-tune the printout and those cannot get individually mapped to IPP options so that the user can control them in a print dialog. Also many print dialogs, especially of phones, are limited to standard IPP attributes. So what we want to add is to have a preset functionality in PAPPL.
I have developed code in PAPPL to introduce preset support, which involves predefined templates for printing defaults. These presets are included in the job-presets-supported attribute of client->response.
In /pappl/printer-webif.c, I created APIs for creating, editing, copying, and deleting presets.
_papplPrinterPreset(): This function shows the homepage of the presets, allowing users to create, edit, copy, and delete presets. _papplPrinterPresetCreate(): This function displays the web page for creating presets. _papplPrinterPresetEdit(): This function displays the web page for editing presets. _papplPrinterPresetCopy(): This function shows the web page for copying presets. _papplPrinterPresetDelete(): This function displays the web page to delete a particular preset. In /pappl/system-loadsave.c, I created an API to save presets in a file (the file is stored in /var/spool/legacy-printer-app/name_of_the_file_for_particular_preset).
papplSystemSavePreset(): This API is used to store presets in files, with each printer having a unique preset file. In /pappl/printer.h, I created the structure of a preset represented by pappl_pr_preset_data_s, which includes fields such as:
Name: A unique name given to the preset. Id: A unique ID assigned to the preset. Static attributes like pappl_color_mode_t color_supported: Each static attribute has a boolean field representing whether the option is selected in the preset on the web interface or not. After that, I wrote the code to store vendor attributes.
In /pappl/printer.c:
papplPresetAdd(): This function fetches presets from the file (stored in /var/spool/legacy-printer-app/file_name.txt). _papplSystemAddPreset(): This function adds the preset to the running printer thread. papplPresetDelete(): This function removes the preset element from the printer's presets array. _papplPresetDelete(): This function removes all memory and resources associated with a particular preset. In /pappl/printer-driver.c, I wrote the code to initialize preset fields when needed, such as during operations like edit, copy, and creation of the preset.
papplPrinterAddPresetCreate(): This function adds a particular preset to the printer thread. papplSetPresetVendor(): This function sets vendor attributes in the preset object. papplSetPresetFromDriver(): This function sets driver attributes in the preset object.
Please let me know what further changes I will need to make. Thank you!