PDF export: box-shadowをprint時にラスタライズしてPreview.appの黒矩形を解消#153
Merged
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…angles Chrome --print-to-pdf emits blurred CSS box-shadows as /S /Luminosity soft masks that macOS Quartz renderers (Preview.app, Quick Look, sips) mis-composite into hard-edged black rectangles. Extend pdf_flatten.js to rasterize supported shadows to RGBA PNGs at print time: outer shadows become an absolutely positioned layer behind the element, inset shadows become the topmost background-image layer. Unsupported values fall back to the original shadow with a console.error, same policy as the gradient flatten. Closes #150 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jul 6, 2026
Closed
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.
Closes #150
問題
peitho export pdfのPDFをmacOS Preview.app / Quick Look / sipsで開くと、box-shadow付き要素の周りに硬いエッジの黒い矩形が出る。HTMLスライドやpoppler/ChromeのPDFビューアでは出ない。根本原因(測定済み)
Chrome
--print-to-pdfはぼかし付きbox-shadowを「黒塗り +/SMask /S /LuminosityExtGState + ぼかしをラスタライズしたDeviceGray画像」としてPDF化する。Quartz系レンダラはこのLuminosity SMaskを誤合成し、マスクBBox境界までの黒矩形として描画する。Issue #142(Type 4シェーディング)と同族のQuartzの透明度処理問題。修正
pdf_flatten.jsをグラデーションflattenと同じ思想で拡張し、print時にbox-shadowをラスタライズする:.peitho-slide直下にposition:absolute; z-index:-1のレイヤーとして敷くbackground-imageの最上層としてprependconsole.errorして元のまま残す(既存flattenと同じフォールバックポリシー、サイレントパスなし)検証
/S /Luminosityアサートで失敗することを確認pdfseparate+sips(Quartz = Preview.appと同じエンジン)でA/B確認: 黒矩形が消え、柔らかい影だけが残る。PDF全体で/S /Luminosityは0件設計記録:
docs/plans/2026-07-06-pdf-shadow-flatten.md🤖 Generated with Claude Code