macos: fit presentation slides to page when printing - #14
Open
lif9e1 wants to merge 1 commit into
Open
Conversation
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
force-pushed
the
fix/macos-print-presentation-fit
branch
from
August 29, 2026 15:34
dfa9f76 to
29827af
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 forcespmFit + ZoomEnablefor presentations — but only whenm_eEditorType == etPresentation. That field is filled atASC_MENU_EVENT_TYPE_CEF_PRINT_STARTfromCCefViewEditor::GetEditorType(), which relies on the application layer callingSetEditorType(). Only the win-linux app does that (cascapplicationmanagerwrapper.cpp); the macOS app never calls it, so on macOS the editor type staysetUndefinedand printing falls back to the defaultCAscPrintSettingsmodepm100(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 cmon 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_XCODE16-px alignment exactly).Fix
At PRINT_START, when the editor type is undefined, detect presentations from the current file format (
AVS_OFFICESTUDIO_FILE_PRESENTATIONfamily 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:
🤖 Generated with Claude Code