slides
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSlides
幻灯片
Overview
概述
Use PptxGenJS for slide authoring. Do not use for deck generation unless the task is inspection-only; keep editable output in JavaScript and deliver both the and the source .
python-pptx.pptx.jsKeep work in a task-local directory. Only copy final artifacts to the requested destination after rendering and validation pass.
使用PptxGenJS进行幻灯片创作。除非任务仅需检视内容,否则不要使用生成演示文稿;请使用JavaScript编写代码生成可编辑输出,同时交付文件和对应的源文件。
python-pptx.pptx.js请在任务专属目录下完成工作,只有经过渲染和校验流程后,才将最终产物复制到要求的目标位置。
Bundled Resources
配套资源
- : Copy this folder into the deck workspace and import it locally instead of reimplementing helper logic.
assets/pptxgenjs_helpers/ - : Rasterize a
scripts/render_slides.pyor.pptxto per-slide PNGs..pdf - : Detect content that overflows the slide canvas.
scripts/slides_test.py - : Build a contact-sheet style montage of rendered slides.
scripts/create_montage.py - : Report missing or substituted fonts as LibreOffice resolves them.
scripts/detect_font.py - : Convert SVG/EMF/HEIC/PDF-like assets into PNGs for quick inspection.
scripts/ensure_raster_image.py - : Load only when you need API details or dependency notes.
references/pptxgenjs-helpers.md
- :将该文件夹复制到演示文稿工作区后本地引入,无需重复实现辅助逻辑。
assets/pptxgenjs_helpers/ - :将
scripts/render_slides.py或.pptx文件逐页栅格化为PNG图片。.pdf - :检测内容是否溢出幻灯片画布边界。
scripts/slides_test.py - :生成渲染后幻灯片的联系人表样式拼接图。
scripts/create_montage.py - :上报LibreOffice解析时缺失或被替换的字体。
scripts/detect_font.py - :将SVG/EMF/HEIC/PDF类资源转换为PNG格式,方便快速检视。
scripts/ensure_raster_image.py - :仅在需要查询API细节或依赖说明时加载。
references/pptxgenjs-helpers.md
Workflow
工作流
- Inspect the request and determine whether you are creating a new deck, recreating an existing deck, or editing one.
- Set the slide size up front. Default to 16:9 () unless the source material clearly uses another aspect ratio.
LAYOUT_WIDE - Copy into the working directory and import the helpers from there.
assets/pptxgenjs_helpers/ - Build the deck in JavaScript with an explicit theme font, stable spacing, and editable PowerPoint-native elements when practical.
- Run the bundled scripts from this skill directory or copy the needed ones into the task workspace. Render the result with , review the PNGs, and fix layout issues before delivery.
render_slides.py - Run for overflow checks when slide edges are tight or the deck is dense.
slides_test.py - Deliver the , the authoring
.pptx, and any generated assets that are required to rebuild the deck..js
- 分析需求,确认你是要创建全新演示文稿、复刻现有演示文稿,还是编辑已有演示文稿。
- 提前设置幻灯片尺寸,默认使用16:9(),除非源素材明确使用其他宽高比。
LAYOUT_WIDE - 将复制到工作目录,从中引入所需辅助工具。
assets/pptxgenjs_helpers/ - 使用JavaScript编写代码构建演示文稿,尽可能使用明确的主题字体、稳定的间距,以及PowerPoint原生可编辑元素。
- 运行本技能目录下的配套脚本,或者将需要的脚本复制到任务工作区。使用渲染结果,检查生成的PNG图片,交付前修复所有布局问题。
render_slides.py - 如果幻灯片内容边界紧凑或者内容密度高,运行检查内容溢出问题。
slides_test.py - 交付文件、编写的
.pptx源文件,以及重新构建演示文稿所需的所有生成类资源。.js
Authoring Rules
创作规则
- Set theme fonts explicitly. Do not rely on PowerPoint defaults if typography matters.
- Use ,
autoFontSize, and related helpers to size text boxes; do not use PptxGenJScalcTextBoxorfit.autoFit - Use bullet options, not literal characters.
• - Use or
imageSizingCropinstead of PptxGenJS built-in image sizing.imageSizingContain - Use for equations and
latexToSvgDataUri()for syntax-highlighted code blocks.codeToRuns() - Prefer native PowerPoint charts for simple bar/line/pie/histogram style visuals so reviewers can edit them later.
- For charts or diagrams that PptxGenJS cannot express well, render SVG externally and place the SVG in the slide.
- Include both and
warnIfSlideHasOverlaps(slide, pptx)in the submitted JavaScript whenever you generate or substantially edit slides.warnIfSlideElementsOutOfBounds(slide, pptx) - Fix all unintentional overlap and out-of-bounds warnings before delivering. If an overlap is intentional, leave a short code comment near the relevant element.
- 明确设置主题字体,如果排版要求高,不要依赖PowerPoint默认字体。
- 使用、
autoFontSize及相关辅助工具设置文本框尺寸,不要使用PptxGenJS的calcTextBox或fit功能。autoFit - 使用项目符号配置,不要直接输入字符。
• - 使用或
imageSizingCrop处理图片尺寸,不要使用PptxGenJS内置的图片大小调整功能。imageSizingContain - 公式使用处理,语法高亮代码块使用
latexToSvgDataUri()处理。codeToRuns() - 简单的柱状图/折线图/饼图/直方图类可视化内容优先使用PowerPoint原生图表,方便审阅者后续编辑。
- 对于PptxGenJS无法很好支持的图表或示意图,可在外部渲染为SVG后插入到幻灯片中。
- 无论你是生成新幻灯片还是大幅编辑现有幻灯片,提交的JavaScript代码中都要包含和
warnIfSlideHasOverlaps(slide, pptx)调用。warnIfSlideElementsOutOfBounds(slide, pptx) - 交付前修复所有非故意的重叠和边界溢出警告。如果重叠是故意设计的,请在相关元素附近添加简短的代码注释。
Recreate Or Edit Existing Slides
复刻或编辑现有幻灯片
- Render the source deck or reference PDF first so you can compare slide geometry visually.
- Match the original aspect ratio before rebuilding layout.
- Preserve editability where possible: text should stay text, and simple charts should stay native charts.
- If a reference slide uses raster artwork, use to generate debug PNGs from vector or odd image formats before placing them.
ensure_raster_image.py
- 首先渲染源演示文稿或参考PDF,方便你直观对比幻灯片布局。
- 重建布局前先匹配原始宽高比。
- 尽可能保留可编辑性:文本保持为文本格式,简单图表保持为原生图表。
- 如果参考幻灯片使用了栅格 artwork,插入前先使用将矢量或者特殊格式的图片生成调试用PNG。
ensure_raster_image.py
Validation Commands
校验命令
Examples below assume you copied the needed scripts into the working directory. If not, invoke the same script paths relative to this skill folder.
bash
undefined以下示例假设你已将需要的脚本复制到工作目录。如果没有,请使用相对于本技能目录的相同脚本路径调用。
bash
undefinedRender slides to PNGs for review
Render slides to PNGs for review
python3 scripts/render_slides.py deck.pptx --output_dir rendered
python3 scripts/render_slides.py deck.pptx --output_dir rendered
Build a montage for quick scanning
Build a montage for quick scanning
python3 scripts/create_montage.py --input_dir rendered --output_file montage.png
python3 scripts/create_montage.py --input_dir rendered --output_file montage.png
Check for overflow beyond the original slide canvas
Check for overflow beyond the original slide canvas
python3 scripts/slides_test.py deck.pptx
python3 scripts/slides_test.py deck.pptx
Detect missing or substituted fonts
Detect missing or substituted fonts
python3 scripts/detect_font.py deck.pptx --json
Load `references/pptxgenjs-helpers.md` if you need the helper API summary or dependency details.python3 scripts/detect_font.py deck.pptx --json
如果需要辅助工具API概要或者依赖详情,请加载`references/pptxgenjs-helpers.md`。