Skip to content

macos: fit presentation slides to page when printing - #14

Open
lif9e1 wants to merge 1 commit into
Euro-Office:mainfrom
lif9e1:fix/macos-print-presentation-fit
Open

macos: fit presentation slides to page when printing#14
lif9e1 wants to merge 1 commit into
Euro-Office:mainfrom
lif9e1:fix/macos-print-presentation-fit

Conversation

@lif9e1

@lif9e1 lif9e1 commented Aug 29, 2026

Copy link
Copy Markdown

Problem

Printing a presentation from the macOS app clips ~21 mm off the left and right edges: a 16:9 slide (960×540 pt = 338.7×190.5 mm) is printed at 100% scale onto A4 landscape (297×210 mm), centered, with the overflow cut off. PowerPoint scales slides to fit the paper, so the same file prints correctly there.

Root cause

CPrintData::CheckPrintRotate() (fileprinter.cpp) already forces pmFit + ZoomEnable for presentations — but only when m_eEditorType == etPresentation. That field is filled at ASC_MENU_EVENT_TYPE_CEF_PRINT_START from CCefViewEditor::GetEditorType(), which relies on the application layer calling SetEditorType(). Only the win-linux app does that (cascapplicationmanagerwrapper.cpp); the macOS app never calls it, so on macOS the editor type stays etUndefined and printing falls back to the default CAscPrintSettings mode pm100 (print at actual size).

Evidence from a print-to-PDF produced before the fix: each page draws the rasterized slide with matrix 959.22 0 0 541.26 -59.11 26.87 cm on a 841.89×595.28 pt page — i.e. 100% slide size, centered, 59 pt clipped per side (the raster dimensions 4000×2256 px match the pm100 branch at 300 dpi plus the _XCODE 16-px alignment exactly).

Fix

At PRINT_START, when the editor type is undefined, detect presentations from the current file format (AVS_OFFICESTUDIO_FILE_PRESENTATION family mask) so the existing fit-to-page path engages. No behavior change on Windows/Linux (editor type already set), for other editor types, or when the format is unknown.

Verification

Rebuilt the macOS app and printed the same 16-slide 16:9 pptx to PDF via the system dialog:

before after
slide draw rect 959×541 pt @ x=-59 (clipped) 840×472 pt @ x=0.4, y=61.4 (fits)
content ~21 mm cut off left+right complete, ~22 mm top/bottom margins

🤖 Generated with Claude Code

On macOS the application layer never calls SetEditorType(), so at
ASC_MENU_EVENT_TYPE_CEF_PRINT_START the editor type is etUndefined and
the forced pmFit/ZoomEnable path for presentations in
CPrintData::CheckPrintRotate() is never taken. Printing then falls back
to the default CAscPrintSettings mode pm100: a 16:9 slide (338.7 mm
wide) is placed on A4 landscape at 100% scale and about 21 mm are
clipped off on each side.

Detect presentations by the current file format as a fallback when the
editor type is undefined, so slides are scaled to fit the paper like
PowerPoint does. No behavior change on Windows/Linux where
SetEditorType() is already called, nor for other editor types.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Shaohui Li <mail@shaohui.li>
@lif9e1
lif9e1 force-pushed the fix/macos-print-presentation-fit branch from dfa9f76 to 29827af Compare August 29, 2026 15:34
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