XpCancelPage(3Xp)

✨ XpCancelPage πŸ’… (XPRINT FUNCTIONS, bestie)

okay so real talk β€” this one lives in the XPRINT FUNCTIONS crew of the X Version 11 manuals, and it's genuinely the "nvm, abort the page" button of the X Print Service. Let's get into it πŸŽ€


🌸 NAME 🌸

XpCancelPage β€” cancels a print page. that's it, that's the whole vibe. one job, and it ate πŸ’…


✨ SYNOPSIS ✨

cc [ flag... ] file... -lXp [ library... ]
#include <X11/extensions/Print.h>

void XpCancelPage ( display, discard )
      Display *display;
      Bool discard;

like, you compile with -lXp, you pull in <X11/extensions/Print.h>, and then you call it. simple as πŸ¦‹


🫢 ARGUMENTS 🫢

  • display β€” a pointer to the Display structure, bestie. the one you got back from XOpenDisplay. yk, the whole "which server am I even talking to" situation.
  • discard β€” when it's TRUE, it means: toss out all those XPPrintNotify events whose detail is XPEndPageNotify. like, into the void. πŸ•³οΈ

πŸ’– DESCRIPTION πŸ’–

XpCancelPage cancels an in-progress print page. emphasis on in-progress, okay, it's not doing magic on pages that already finished and left the group chat.

so here's the tea πŸ“ β€” if the job was started with output_mode XPGetData, then the data stream to XpGetDocumentData gets interrupted. no further data gets generated for the current page, but data for subsequent pages can still be generated. and listen, for many page description languages, that kind of arbitrary interruption may straight-up invalidate the output. so like… be aware, no cap 😭

if the job was started with output_mode XPSpool, then depending on the driver and spooler implementation, either the entire page may be canceled or a partial page may be generated. it's giving "depends on the implementation" energy, we don't make the rules 🫠

if discard is True, then all the XPPrintNotify events with a detail field of XPEndPageNotify are discarded before XpCancelPage returns. like, they're gone-gone before the function even comes back. πŸ’€

and for clients selecting XPPrintMask (see XpSelectInput), the event XPPrintNotify gets generated with its detail field set to XPEndPageNotify when the X Print Server has completed XpCancelPage. so you do get receipts, bestie πŸ‘‘


πŸ”₯ DIAGNOSTICS πŸ”₯

  • XPBadSequence β€” the function was not called in the proper order with respect to the other X Print Service Extension calls. the example they give: XpStartPage was called before XpStartJob, or it was called for a type XPDocRaw document. so like, sequence check said no πŸ™ˆ

πŸ‘€ SEE ALSO πŸ‘€

  • XpGetDocumentData(3Xp)
  • XpSelectInput(3Xp)
  • XpStartJob(3Xp)
  • XpStartPage(3Xp)

and that's the page, bestie 🧚 go cancel something responsibly. this was X Version 11, libXp 1.0.4, mwah πŸ’œπŸŽ€

πŸ“¦ where this page comes from