Skill站外收录 @skilllib/skill-2014279425246834690
pdf-viewing
支持对 PDF 文件进行光学字符识别并保留页码信息,将每页内容分别提取为结构化文本和纯文本;可按需将指定页面渲染为高精度图像,支持多种格式与分辨率;同时提供元数据解析和本地临时文件清理能力。
内容与媒体 AI 技能
Skills.MD
# Pdf Viewing
## Overview
Use this skill to OCR PDFs with docling and preserve page numbers, rasterize pages into images, or inspect PDF metadata. Always save outputs under a local project directory (default: `./.pdf-artifacts/<pdf-stem>`).
## Quick Start
1. Create a local venv in the project and install deps as dev dependencies:
```bash
uv venv
uv add --dev docling typer pymupdf
```
2. Run the OCR tool:
```bash
uv run python scripts/pdf_tools.py ocr path/to/file.pdf --out-dir ./.pdf-artifacts/<pdf-stem>
```
3. Run the rasterizer:
```bash
uv run python scripts/pdf_tools.py rasterize path/to/file.pdf --out-dir ./.pdf-artifacts/<pdf-stem>
```
## Tasks
### OCR with page tracking
- Command: `uv run python scripts/pdf_tools.py ocr <pdf-path>`
- Output (default): `./.pdf-artifacts/<pdf-stem>/ocr-pages.json` and `ocr-pages.txt`
- Behavior: Copies the input PDF into the output dir and writes per-page text with page numbers.
**Explicit flags**
- `--out-dir <dir>`: output directory (relative paths are rooted at the project root)
- `--project-root <dir>`: base path for relative output paths
- `--copy-pdf / --no-copy-pdf`: control whether the input PDF is copied into the output dir
- `--pages <ranges>`: page ranges like `1-3,5,8-10`
- `--pages-json <name>`: JSON filename for per-page text
- `--pages-text <name>`: TXT filename for per-page text
- `--manifest <name>`: manifest filename (default `manifest.json`)
- `--overwrite / --no-overwrite`: overwrite existing outputs
- `--dry-run`: show what would be written
### Rasterize to images
- Command: `uv run python scripts/pdf_tools.py rasterize <pdf-path>`
- Output (default): `./.pdf-artifacts/<pdf-stem>/images/page-0001.jpg` (etc.)
- Behavior: Renders each PDF page to an image at the requested DPI.
**Explicit flags**
- `--out-dir <dir>`: output directory (relative paths are rooted at the project root)
- `--project-root <dir>`: base path for relative output paths
- `--copy-pdf / --no-copy-pdf`: control whether the input PDF is copied into the output dir
- `--pages <ranges>`: page ranges like `1-3,5,8-10`
- `--dpi <int>`: rasterization DPI
- `--format <jpg|png|webp>`: output image format
- `--quality <1-100>`: for jpg/webp
- `--images-dir <name>`: directory for output images
- `--images-manifest <name>`: JSON manifest name with image paths
- `--manifest <name>`: manifest filename (default `manifest.json`)
- `--overwrite / --no-overwrite`: overwrite existing outputs
- `--dry-run`: show what would be written
### Inspect metadata
- Command: `uv run python scripts/pdf_tools.py inspect <pdf-path>`
- Output: writes metadata to stdout and `manifest.json` unless `--no-manifest`
### Clean artifacts
- Command: `uv run python scripts/pdf_tools.py clean <pdf-path>`
- Behavior: Removes the artifact directory for the PDF.
## Notes
- Keep outputs inside the current project by using the default output directory or a relative `--out-dir`.
- If docling requires extra OCR backends in your environment, install them before running OCR.
## Tools
- `scripts/pdf_tools.py`: Typer CLI with `ocr`, `rasterize`, `inspect`, and `clean` commands.
评论 0
还没有评论,来抢沙发。
相关内容
同类或同场景的收录内容
building-with-kafka-strimzi
在 Kubernetes 上构建基于 Apache Kafka 的事件驱动系统,支持高可靠的消息传递、事务性处理与精确一次语义,结合 Strimzi 运营商实现集群自动化管理,利用 Schema Registry 保障事件模式演进,适用于微服务间解耦通信与实时数据流处理场景。
站外数据与分析
609 0.0
personal-tool-builder
专注于从个人真实痛点出发快速构建实用工具,涵盖命令行程序、本地优先应用和自动化脚本的开发与演进,强调先满足自身需求再逐步扩展,通过持续自用打磨功能,避免过度设计,确保工具简洁有效且长期可维护。
站外商业与营销
196 0.0
threejs-lighting
实现三维场景中的光照与阴影控制,支持多种光源类型及环境光照明,提供从基础布光到高级阴影优化的完整方案,适用于需要真实感渲染或性能平衡的可视化项目。
站外效率工具
442 0.0
aggregation-helper
提供数据聚合场景的自动化辅助能力,涵盖 SQL 查询编写、统计分析建模、可视化方案设计及商业智能配置,支持从需求理解到生产级代码生成的全流程指导。
站外效率工具数据与分析
217 0.0
举报「pdf-viewing」
举报信息仅审核团队可见,同一资产 24 小时内仅可举报一次