Files
pdfcraft/docs/editing-images.md
T
6d843a8e8b Preserve source fonts in text editing and resize clipped artwork (#1116)
* M0: remove upstream trademark artwork from contributor fork

Use the existing document icon and a plain project label. Remove trademark
asset entries and regenerate attribution as required for modified forks.

Co-authored-by: OpenAI Codex <codex@openai.com>

* M7: group compatible PDF words and hide source text during editing

Join compatible words across text objects and subset-font spaces, recognize
component colours, and reuse subset fonts with numeric space positioning.
Render a read-only background with the selected glyphs removed while the
inline editor is open. Keep one frame and source line breaks, and reset
the layout width when switching paragraphs. Expose the same preview through page_render.

Add synthetic extraction, save/reopen, preview and UI regressions. Record
the remaining mixed-style paragraph and installed-font limitations.

Co-authored-by: OpenAI Codex <codex@openai.com>

* M7: preserve rich PDF regions and preview text edits in place

Group mixed source runs into complete visual regions, retain run styles and source encodings, and use validated embedded source faces in the inline editor. Preserve source baselines and show a single live frame as text grows or shrinks, backed by a read-only draft geometry tool.

Validation: strict workspace Clippy, workspace tests, all 30 WASM crates, asset and parity gates, licensed synthetic edit/save/reopen and desktop checks, and an opt-in four-page private-document regression.

Co-authored-by: OpenAI Codex <codex@openai.com>

* M7: keep cropped artwork from blocking text editing

Track page/path clipping separately from full image placement, use visible selection bounds, and prioritize text hit testing over overlapping artwork. Preserve fixed clips during image transformations and expose visible bounds through the headless tools.

Validation: strict workspace Clippy, workspace tests, 30 WASM crates, asset/parity gates, synthetic engine/tool/UI and native desktop checks, both private-document UI regressions, and all-page local edit/save/reopen/undo on a four-page cropped-artwork PDF.

Co-authored-by: OpenAI Codex <codex@openai.com>

* M7: resize cropped images with their clipping paths

Keep the visible frame and image pixels under the same transform. Preserve the
opposite corner and respond to diagonal, horizontal-only and vertical-only
corner drags without jumping from an off-centre grip. Refuse shared clipping
scopes that would move unrelated content.

Add synthetic engine/tool/UI regressions and opt-in private-file coverage
for 80 corner gestures and 10 grow/shrink save/reopen/undo render checks.

Co-authored-by: OpenAI Codex <codex@openai.com>

* M7: complete source font subsets and preserve clipped editing

Add explicit document fonts, CFF embedding, range formatting and bounded contextual shaping; isolate shared image clips and verify private Chinese edits on all pages.

Co-authored-by: OpenAI Codex <codex@openai.com>

* Revert "M0: remove upstream trademark artwork from contributor fork"

This reverts commit 3aa539b5b6.

* Test: give the text layer up to 4 s before copying (it flaked on a loaded machine)

---------

Co-authored-by: Kamoliddin Fatkhullaev <komoliddinfatxullayev@MacBook-Pro-Komoliddin.local>
Co-authored-by: OpenAI Codex <codex@openai.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 20:27:55 -04:00

3.0 KiB

Editing existing images and figures

In Edit a PDF → Edit text and images, click a figure to select it. Drag the selected figure to move it, drag a corner to resize it proportionally, or press Delete to remove that placement. The context menu also rotates or flips it. Changes support undo and survive saving/reopening. An image painted inside its own rectangular clip (q … re W n … cm Do Q, as PowerPoint exports it) moves and resizes together with that clip; a clip shared with other content stays where it is.

PDF figures are not always bitmap images. Imported diagrams often use a Form XObject, which packages text, vector paths, and nested images into one object. PdfCraft selects this object using its BBox and optional Matrix and edits it as a whole. Its original content, resources, clipping box, and transparency settings remain intact. Moving or deleting one use of a shared figure does not alter its other placements or pages.

Replace Image and Save Image As apply only to raster Image XObjects; these menu items are disabled for grouped Form artwork. The tool does not ungroup Forms, edit their individual internal elements, select arbitrary ungrouped vector paths, or edit inline images (BI/ID/EI). A Form's bounding box may include whitespace.

For automation, page_images lists both kinds with kind: "image" or kind: "form". Forms have pixels: [0, 0], since they have no single bitmap resolution. Use the returned number with image_edit (move, rotate, flip_horizontal, flip_vertical, delete). Coordinates are top-left-origin page points. image_save and image_edit's replace action return a clear error for Form artwork.

Selection frames follow the visible portion of artwork after page and path clipping. Clicking editable text takes precedence over overlapping artwork, including labels inside an image's visible rectangle. Hidden image placements have no selection frame. Bezier extrema determine curved-path frames. Hit testing evaluates the actual clipping paths with their nonzero or even-odd fill rule, so holes and empty corners do not intercept clicks. Intersections of several curved clips can still have a loose bounding frame. Dragging the visible frame moves or resizes the full placement by the same change; resizing keeps the opposite corner fixed, including horizontal-only or vertical-only corner drags, and grabbing a grip slightly off-centre does not jump. A selected corner keeps control of its drag even over a text label; the drag previews one frame and applies one undoable edit on release. A clip that belongs to the image alone (q re W n cm Do Q) moves with it; a clip shared with other content stays where it is.

image_hit applies the same path and hole checks headlessly. page_images retains rect as the full placement rectangle used by image_edit and adds visible_rect for selection (null when fully clipped). object_list reports visible artwork bounds while keeping the original source indexes. A selection frame does not create, remove or enlarge the PDF's clipping path.