Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[Bug][pdf-plugin] pdf.py 引用不存在的 html2pdf.js,convert.html 入口对所有用户失效

未关闭 适合新手
#106 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
1/5
预计耗时
1 小时以内
新手友好度
85/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
javascript, python
领域
cli

调研方向

过时的引用在 pdf.py 中:convert.html 路径(约 L1878-1882)中,js_path 由 html2pdf.js 构建,L2086-2088 附近的第二处用法也做了同样的事。请先确认 scripts 目录中只包含 html2pdf-next.js,然后将所有指向 html2pdf.js 的引用改为指向 html2pdf-next.js。当 python pdf.py convert.html any.html -o out.pdf 生成 PDF 而不是报 DependencyMissing 错误时,即为完成。

由索引模型根据 Issue 内容生成。

描述

Description

pdf.py 的 convert.html 命令引用 html2pdf.js,但插件包内的实际文件是 html2pdf-next.js。该入口随包即失效,对所有用户可复现——推测是脚本改名为 -next 版本时未同步更新引用方。

Steps to Reproduce

  1. 进入 pdf skill 的 scripts/ 目录(随 ZCode 安装包内置路径 resources/glm/packages/pdf-plugin/skills/pdf/scripts/,或插件缓存副本);
  2. 执行:python pdf.py convert.html any.html -o out.pdf。

Expected Behavior

convert.html 走通 HTML→PDF 转换。

Actual Behavior

{ "status": "error", "error": "DependencyMissing", "message": "html2pdf.js not found in scripts directory" }

Evidence

上游 main 分支 apps/zcode-cli/packages/pdf-plugin/skills/pdf/scripts/pdf.py:

  • L1878:"""Convert HTML to PDF via node html2pdf.js."""
  • L1882:js_path = _SCRIPT_DIR / "html2pdf.js"
  • L2086/L2088:注释与 js_script = _SCRIPT_DIR / "html2pdf.js"

同目录文件清单只有 html2pdf-next.js,无 html2pdf.js:
https://github.com/zai-org/ZCode/tree/main/apps/zcode-cli/packages/pdf-plugin/skills/pdf/scripts

发行包 0.1.8(随安装程序内置)同样如此。直跑 html2pdf-next.js 可绕开这条入口。

Suggested Fix

将 pdf.py 中全部 html2pdf.js 引用改为 html2pdf-next.js(或在 scripts 目录提供别名文件)。实测 html2pdf-next.js 功能完整,是唯一现存入口。

Environment

  • OS:Windows 11
  • 版本:pdf-plugin 0.1.8(ZCode 安装包内置);上游 main 分支同样存在
主要语言
Python
星标
103
派生
78
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

zai-org/zcode-plugins 的其他 Issue

查看 zai-org/zcode-plugins 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。