pptx-pdf-font-fix

TotalClaw 作者 totalclaw

通过修补 PPTX 文件中的文本透明度来修复 PDF 导出中的 PowerPoint 字体嵌入问题。当用户的 PPTX 文件中导出的 PDF 显示错误/默认字体而不是预期的下载/自定义字体时使用,即使启用了字体嵌入也是如此。通过对完全不透明的文本运行应用最小 (1%) 透明度来工作,这会强制 PowerPoint 在 PDF 导出期间正确嵌入字体。

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install totalclaw:totalclaw~chernojagne-pptx-pdf-font-fix
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~chernojagne-pptx-pdf-font-fix/file -o chernojagne-pptx-pdf-font-fix.md
## 概述(中文)

通过修补 PPTX 文件中的文本透明度来修复 PDF 导出中的 PowerPoint 字体嵌入问题。当用户的 PPTX 文件中导出的 PDF 显示错误/默认字体而不是预期的下载/自定义字体时使用,即使启用了字体嵌入也是如此。通过对完全不透明的文本运行应用最小 (1%) 透明度来工作,这会强制 PowerPoint 在 PDF 导出期间正确嵌入字体。

## 原文

# PPT Font Fix

## Problem

PowerPoint's "Export to PDF" can fail to embed downloaded/custom fonts, substituting built-in defaults, even when:
- Fonts are properly installed and embeddable
- "Embed fonts in the file" is checked in PowerPoint options

## Workaround

Applying a tiny transparency (1%) to text with 0% transparency forces PowerPoint to correctly embed fonts in PDF output. This is visually imperceptible but changes how PowerPoint processes the font during export.

## Usage

```bash
python3 scripts/fix_font_transparency.py input.pptx [output.pptx] [--transparency 1]
```

### Options

- `output` -- Output PPTX path (default: `input_fixed.pptx`)
- `--transparency, -t` -- Transparency % to apply (default: 1)

## Behavior

- Only patches text runs that are fully opaque (0% transparency)
- Leaves text that already has any transparency untouched
- Safe to run multiple times
- Only modifies slide XML (`ppt/slides/slideN.xml`), not layouts/masters

## Workflow

1. Receive PPTX file from user
2. Run the fix script: `python3 scripts/fix_font_transparency.py input.pptx`
3. Return the patched PPTX to the user
4. User opens patched file in PowerPoint and exports to PDF -- fonts now embed correctly

## Note

PDF export must be done from PowerPoint desktop. Server-side converters (LibreOffice, Graph API) do not reproduce the same font embedding behavior.