Skip to content

Media UI

Michael R Sweet edited this page Mar 22, 2025 · 4 revisions

LPrint provides a custom media chooser that allows users to configure custom label sizes for a printer.

Source files:

  • "lprint-common.c": Functions
  • "lprint.h": Definitions

API

lprint_cmedia_t

typedef struct lprint_cmedia_s              // Custom label sizes (per-printer/source)
{
  char custom_name[PAPPL_MAX_SOURCE][128];  // Custom media size names
} lprint_cmedia_t;

The lprint_cmedia_t structure records custom label sizes for each media source. Each custom_name string is a PWG self-describing media size name.

lprintMediaLoad

bool                                  // O - `true` on success, `false` on error
lprintMediaLoad(
    pappl_printer_t        *printer,  // I - Printer
    pappl_pr_driver_data_t *data)     // I - Printer driver data

Load custom label sizes for a printer.

lprintMediaMatch

const char *                   // O - Matching media size or `NULL` if none
lprintMediaMatch(
    pappl_printer_t *printer,  // I - Printer
    int             source,    // I - "media-source" index (0-based)
    int             width,     // I - Width in hundredths of millimeters or `0` if unknown
    int             length)    // I - Length in hundredths of millimeters

Match the loaded media to one of the supported or custom sizes.

lprintMediaSave

bool                                  // O - `true` on success, `false` on error
lprintMediaSave(
    pappl_printer_t        *printer,  // I - Printer
    pappl_pr_driver_data_t *data)     // I - Printer driver data

Save custom label sizes for a printer.

lprintMediaUI

bool                           // O - `true` on success, `false` on error
lprintMediaUI(
    pappl_client_t  *client,   // I - HTTP client
    pappl_printer_t *printer)  // I - Printer

Show the printer media web page. This replaces the standard PAPPL "/media" page.

lprintMediaUpdate

void
lprintMediaUpdate(
    pappl_printer_t        *printer,  // I - Printer
    pappl_pr_driver_data_t *data)     // I - Printer driver data

Update the list of custom label sizes for a printer.

Clone this wiki locally