Skip to content

Export vector PDF pages: ink as paths, text as text, images as images - #95

Open
marcosqlbi wants to merge 1 commit into
feature/export-e3-editable-deckfrom
feature/export-e4-vector-pdf
Open

Export vector PDF pages: ink as paths, text as text, images as images#95
marcosqlbi wants to merge 1 commit into
feature/export-e3-editable-deckfrom
feature/export-e4-vector-pdf

Conversation

@marcosqlbi

Copy link
Copy Markdown
Collaborator

Why

Phase E4 of docs/export.md, on top of #94 (base is the E3 branch; retarget to main once it merges). A picture page is exact but soft under zoom and dead to selection. A reader who wants to copy the DAX off a page, or print at any size, needs the text to be text and the ink to be paths.

What it does

  • Page content: Picture or Vector, a choice on the Export dialog for PDF, with Picture the default because it is exact.
  • Vector reuses the editable slide's element list, with one difference: the ink goes out as strokes in their own z-order between the containers rather than as one overlay, because a path costs nothing to layer correctly.
  • A stroke is the sweep of its nib. For each pair of points the writer fills the convex hull of the two nib polygons, which is exactly the area a convex nib sweeps along a segment, and joins every hull into one path filled once with the non-zero rule, so a translucent stroke does not darken where it overlaps itself. The nibs follow WPF: a pen is an ellipse whose diameter is thickness × 2 × pressure, a highlighter a flat rectangle with no pressure drawn at half opacity when its color is opaque, calligraphy a tall bar following pressure.
  • Text is laid out in the writer: paragraphs on line breaks, runs measured left to right, wrapped at the last space that fits, in the language's font at the board's size, clipped to the container as the board clips it. Fonts are embedded as subsets of Segoe UI and Consolas from the Windows fonts folder, with Arial and Courier New standing in.

Where the code is

  • SQLBI.Whiteboard.Export/ExportPage.cs: SlideInkElement, SlideStroke, SlidePoint.
  • PdfDocumentWriter: draws elements into the rectangle the picture would have used; the font resolver serves both families in four styles.
  • EditableSlide builds strokes in z-order when asked; ExportSettings and the dialog gain the page content choice.
  • Smoke tests write a vector page with a pen, a highlighter, a calligraphy stroke, and a dot, and check that the text's font is embedded.

The smaller calls are under E4 in docs/export-decisions.md; decision 26 is updated.

🤖 Generated with Claude Code

Page content gains Vector beside the exact picture. A vector page reuses
the editable slide's elements, with the ink as strokes in their own
z-order: each stroke is the sweep of the nib WPF uses, the convex hull of
the nib at consecutive points joined into one path and filled once, so a
translucent highlighter does not darken over itself. Text is laid out
line by line in the language's font, wrapped at the container's width,
and embedded as subsets of Segoe UI and Consolas read from the Windows
fonts folder. The page stays sharp at any zoom and the code can be
selected and copied.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant