pdf-splitter

pdf-splitter: a browser-based PDF vertical-splitting tool. Splits each PDF page vertically into left and right halves, suitable for splitting A3 PDFs into two A4 pages or cutting any PDF page vertically in half. Implemented purely client-side, no server required.

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 "pdf-splitter" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-0da12f62ecb0ba5ba9fad728824ee948cb593df65a913f0638eac1d5c0228a71. Verify the upstream source and version against https://skillhub.cn/skills/user_65552cbf/xhy-pdf-splitter 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

pdf-splitter: a browser-based PDF vertical-splitting tool. Splits each PDF page vertically into left and right halves, suitable for splitting A3 PDFs into two A4 pages or cutting any PDF page vertically in half. Implemented purely client-side, no server required.

0 Downloads

Introduction source: third_party · user_65552cbf · 1.0.0 Reference

SkillPi interpretation

Tasks
Browser-based PDF vertical split tool. Splits each PDF page into left and right halves. Invoke when user needs to split A3 PDF into two A4 pages, or cut any PDF page vertically in half. Pure client-side, no server needed.
Software, accounts and paid services
Translation pending; see source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: "pdf-splitter"
description: "Browser-based PDF vertical split tool. Splits each PDF page into left and right halves. Invoke when user needs to split A3 PDF into two A4 pages, or cut any PDF page vertically in half. Pure client-side, no server needed."

PDF 对半切割工具

功能概述

将 PDF 文件的每一页竖向对半切割成左右两页,按顺序重新生成新的 PDF。例如 A3 左右两页切割后变成 A4 的两页。

技术原理

  • 纯前端实现:使用 pdf-lib (JavaScript) 在浏览器中直接处理 PDF,无需服务器
  • 矢量裁剪:通过 copyPages + setMediaBox 修改页面裁剪框,保留矢量内容,文字可选、文件小、无质量损失
  • 旋转自适应:自动检测页面旋转角度(0/90/180/270),正确处理不同方向的切割
    • 旋转 0°/180°:沿 x 轴(左右)切割
    • 旋转 90°/270°:沿 y 轴(上下)切割,因为原始坐标的上下 = 视觉上的左右

核心代码逻辑

// 读取 PDF
const srcDoc = await PDFDocument.load(arrayBuffer);
const outDoc = await PDFDocument.create();

for (let i = 0; i < total; i++) {
  const srcPage = srcDoc.getPage(i);
  const { width, height } = srcPage.getSize();
  const rotation = srcPage.getRotation().angle;

  if (rotation === 90 || rotation === 270) {
    const mid = height / 2;
    // 左半页 = 原始坐标系上半
    const [leftCopied] = await outDoc.copyPages(srcDoc, [i]);
    leftCopied.setMediaBox(0, mid, width, height - mid);
    outDoc.addPage(leftCopied);
    // 右半页 = 原始坐标系下半
    const [rightCopied] = await outDoc.copyPages(srcDoc, [i]);
    rightCopied.setMediaBox(0, 0, width, mid);
    outDoc.addPage(rightCopied);
  } else {
    const mid = width / 2;
    // 左半页 = 原始坐标系左半
    const [leftCopied] = await outDoc.copyPages(srcDoc, [i]);
    leftCopied.setMediaBox(0, 0, mid, height);
    outDoc.addPage(leftCopied);
    // 右半页 = 原始坐标系右半
    const [rightCopied] = await outDoc.copyPages(srcDoc, [i]);
    rightCopied.setMediaBox(mid, 0, width - mid, height);
    outDoc.addPage(rightCopied);
  }
}

使用方式

  1. 打开 index.html(纯静态页面,双击即可在浏览器中打开)
  2. 拖拽 PDF 文件到页面,或点击选择文件
  3. 自动切割并下载 _切割版.pdf

部署方式

  • Netlify Drop:直接拖拽 index.html 到 https://app.netlify.com/drop 即可生成在线链接
  • GitHub Pages:上传到 GitHub 仓库,开启 Pages 即可
  • 本地使用:双击 index.html 直接用浏览器打开

依赖

  • pdf-lib v1.17.1(通过 CDN 引入,无需安装)

扩展能力

基于 pdf-lib 还可扩展:

  • PDF 合并(多个 PDF 拼接成一个)
  • 添加水印(文字/图片)
  • 页面旋转
  • 删除/插入/移动页面
  • 填写 PDF 表单
  • 生成证书/批量填表

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 Value85/100

Highlights

  • 解决 A3 转 A4 等实际办公场景需求
  • 纯前端实现无需服务器,实用性强
Trigger Precision90/100

Highlights

  • 触发场景明确(A3 PDF 拆分为 A4、任意 PDF 页面垂直对半切开)
  • 覆盖合理且边界清晰
Structure and Standards95/100

Highlights

  • 文档结构完整,包含功能概述、技术原理、核心代码逻辑、使用方式、部署方式、依赖和扩展能力
  • 步骤清晰,有端到端示例
Execution Reliability90/100

Highlights

  • 工具来源明确(pdf-lib),参数正确
  • 覆盖了页面旋转自适应等异常情况
  • 纯前端实现无不可逆操作风险
Evidence Verifiability (mean of the first four)90/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.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

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.

  • app.netlify.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.