caj2pdf-converter

Converts CNKI CAJ format documents to PDF, supporting single-file and directory batch conversions. Implemented using the open-source caj2pdf tool, for scenarios requiring conversion of .caj files to PDF.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "caj2pdf-converter" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-24296b03d5a64972168ee6234ebc7185e37b0356a10e63a8e58da77e981e9d40. Verify the upstream source and version against https://skillhub.cn/skills/user_3a8d3353/cajtopdf before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Converts CNKI CAJ format documents to PDF, supporting single-file and directory batch conversions. Implemented using the open-source caj2pdf tool, for scenarios requiring conversion of .caj files to PDF.

0 Downloads

Introduction source: third_party · user_3a8d3353 · 1.0.0 Reference

SkillPi interpretation

Tasks
Translation pending; see source documentation.
Audience
Translation pending; see source documentation.
Inputs and outputs
Translation pending; see source documentation.
Software, accounts and paid services
Translation pending; see source documentation.
Limits and differences
Not specified in the source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: caj2pdf-converter
description: "将中国知网 CAJ 格式文献转换为 PDF 文件。支持单个文件转换和目录批量转换。当用户需要转换 .caj 文件为 PDF、提到 CAJ转PDF、知网文献转换、打不开CAJ文件 等场景时触发此技能。基于开源 caj2pdf 工具实现。"
agent_created: true

CAJ to PDF Converter

Overview

将中国知网(CNKI)专有的 CAJ 格式文献转换为通用 PDF 文件。支持 CAJ、C8、KDH、PDF/CAJ 等多种子格式,支持单个文件转换和目录批量转换。基于开源工具 caj2pdf 实现。

When to Use

  • 用户提供 .caj 文件路径,要求转换为 PDF
  • 用户提到"CAJ转PDF"、"知网文献转换"、"打不开CAJ文件"
  • 用户有一批 CAJ 文件需要批量转换为 PDF
  • 用户询问如何在不安装 CAJViewer 的情况下查看 CAJ 文件

Prerequisites

转换依赖以下组件(caj2pdf 库已打包在技能内,Python 依赖首次运行时自动安装):

依赖 安装方式 说明
mutool brew install mupdf(macOS) 需手动安装,用于修复 PDF xref 表
PyPDF2 自动安装 PDF 书签操作
imagesize 自动安装 图像尺寸解析
caj2pdf 库 已打包 核心转换库,位于 caj2pdf_lib/ 目录

若 mutool 未安装,脚本会报错并提示安装命令。

How to Use

1. 单个文件转换

当用户提供一个 CAJ 文件路径时:

/Users/ysir0129/.workbuddy/binaries/python/envs/default/bin/python \
  ~/.workbuddy/skills/caj2pdf-converter/scripts/convert_caj.py \
  convert <input.caj> [-o output.pdf]
  • 若不指定 -o,输出文件与输入文件同名,扩展名改为 .pdf
  • 添加 -v 可在转换前显示文件信息(格式类型、页数、大纲数)

2. 批量转换

当用户指定一个目录,需要转换其中所有 CAJ 文件时:

/Users/ysir0129/.workbuddy/binaries/python/envs/default/bin/python \
  ~/.workbuddy/skills/caj2pdf-converter/scripts/convert_caj.py \
  batch <input_dir> [-o output_dir] [-v]
  • 递归搜索目录下所有 .caj 文件
  • 若指定 -o,转换后的 PDF 输出到指定目录(保持相对路径结构)
  • 若不指定 -o,PDF 输出到各 CAJ 文件同目录

3. 查看文件信息

转换前可先查看 CAJ 文件的基本信息:

/Users/ysir0129/.workbuddy/binaries/python/envs/default/bin/python \
  ~/.workbuddy/skills/caj2pdf-converter/scripts/convert_caj.py \
  show <input.caj>

4. 手动初始化环境

如需提前检查和安装依赖(不执行转换):

/Users/ysir0129/.workbuddy/binaries/python/envs/default/bin/python \
  ~/.workbuddy/skills/caj2pdf-converter/scripts/convert_caj.py \
  setup

5. 更新 caj2pdf 库

如需从 GitHub 更新 caj2pdf 核心库(修复 Bug 或支持新格式时使用):

/Users/ysir0129/.workbuddy/binaries/python/envs/default/bin/python \
  ~/.workbuddy/skills/caj2pdf-converter/scripts/convert_caj.py \
  update-lib

Workflow

  1. 确认用户提供的文件/目录路径存在
  2. 运行 show 命令查看文件格式信息(可选,用于确认文件可被解析)
  3. 运行 convert 或 batch 命令执行转换
  4. 向用户报告转换结果(成功/失败、输出路径)
  5. 若失败,参考下方故障排查

Output

  • 脚本输出格式:OK: <input> -> <output> 或 ERROR: <message>
  • 批量转换结束时输出汇总:Conversion complete: N succeeded, M failed.
  • 转换过程中产生的临时文件会自动清理

Troubleshooting

"Unknown file type"

文件格式不被 caj2pdf 支持。可能原因:

  • 文件已损坏或不完整
  • 文件使用了较新的未知内部结构
  • 文件实际上不是 CAJ 格式

建议用户尝试使用 CAJViewer 打印为 PDF 作为替代方案。

"mutool not found"

mutool 未安装。运行 brew install mupdf(macOS)安装。

HN 格式转换失败

HN 格式需要额外的编译共享库。macOS 用户可从 caj2pdf-extra-libs 下载,放置到 caj2pdf_lib 目录并赋予执行权限。

转换后 PDF 内容异常

caj2pdf 是非官方逆向工程工具,部分文件可能转换不完整。参考 references/caj_format_reference.md 了解格式详情和已知限制。

Resources

scripts/

  • convert_caj.py — 主转换脚本,支持 convert / batch / show / setup / update-lib 五个子命令

references/

  • caj_format_reference.md — CAJ 文件格式详细参考,包含各子格式的识别方式、转换原理、已知限制和依赖说明

Current listing version

1.0.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value88/100

Highlights

  • 解决知网 CAJ 文件转换的实际刚需,支持单文件与批量转换
  • 功能完整闭环,受众广泛,实用价值高
Trigger Precision92/100

Highlights

  • 触发词覆盖全面:.caj 文件路径、CAJ转PDF、知网文献转换等场景
  • 边界清晰,不易误触或漏触
Structure and Standards90/100

Areas to improve

  • 文档长度略长 Reported severity: Minor

    SKILL.md 文档约600行,内容详尽但略显冗长

    Recommendation: 可考虑将部分技术细节移至 references/ 目录,保持主文档简洁

Highlights

  • Phase/步骤清晰,子命令划分明确
  • 含端到端命令示例,frontmatter 完整
Execution Reliability85/100

Highlights

  • 工具来源明确(caj2pdf 开源项目),依赖管理清晰
  • 覆盖主要异常场景(mutool 缺失、文件格式不支持等)
  • 提供故障排查与替代方案
Evidence Verifiability (mean of the first four)89/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

  • Install or fetch external dependencies

    Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.

    Mentioned in main document · lines 26, 119
Domains or addresses referenced in the document

These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.

  • github.com

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Translation pending; see source documentation.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.