DSH HUB
HomePlugin StorePlugin PacksCommunityRankingsResourcesPublish Guide
Plugin source
Back to catalog

550AW /

550AW/dsh-pdf-to-image

Verified

Rasterize PDF pages to PNG inside DeepSeek Harness, with page ranges, DPI control, and inline previews.

★ 0 Stars0 Forks0 IssuesN/A Community rating0 Confirmed installs
View on GitHub
READMESource: main@6d6b3682

dsh-pdf-to-image

Repository: https://github.com/550AW/dsh-pdf-to-image · Version: 1.0.1

A DeepSeek Harness plugin that turns PDF pages into PNG images the agent can look at.

dsh-pdf-to-image

What it does

DeepSeek Harness (DSH) agents can read images but cannot see inside a PDF. This plugin adds one Host tool, pdf_to_image, which rasterizes selected pages with PDFium and writes one PNG per page — then optionally attaches the first few pages to the result so the agent reads them directly instead of guessing at a path.

It registers exactly one tool and nothing else.

Parameter Meaning
input PDF path; relative paths resolve against the session working directory.
output_dir Where the PNGs go, created when missing. Defaults to <pdf folder>/<pdf name>-pages. Files with the same names are replaced.
pages One-based: 3, 2-5, 6-, or 1-3,7. Default is every page, up to 200 pages per call.
dpi 24–600, default 150. 300 is print quality and much larger.
preview Attach the first four rendered pages to the result, when the model accepts images.

Pages are named <pdf name>-pNN.png, zero-padded to at least two digits and to the width of the page count (a 1,200-page PDF uses p0001).

Behavior and limits

  • Every path goes through DSH's filesystem and sandbox services: the session's read policy gates the PDF, and the session's sandbox policy fences the output folder. The output directory is resolved to its real path before the check, so a junction or symlink cannot climb out of the writable roots; writes outside the roots, a read-only session, and traversal are structured errors.
  • Pages with no printable area are rejected instead of producing broken files: a zero-area MediaBox (0.1 × 0.1), a faked /Count, or a missing /Kids page yields an error naming the page and the 0x0 render, and no corrupt PNG is written. If earlier pages were already written, the error says so.
  • Limits: input PDFs up to 256 MB; up to 200 pages selected per call; DPI 24–600; 40 MP per rendered page. Pages above the pixel budget are rejected before rasterizing, so a huge page cannot exhaust memory.
  • Encrypted PDFs are rejected; PDFium reports them as password-protected. Only the first four pages are attached in preview mode, and only when the current model accepts image input.

Install

The repository and the release zip do not include node_modules/. Install the two runtime dependencies first, then install the bundle.

@hyzyla/pdfium 3.0.0 is a WebAssembly build (dist/pdfium.wasm, about 5.3 MB): the same .wasm module is used on every OS, nothing is compiled during install, and no per-platform binary is involved. pngjs is plain JavaScript.

From the GitHub repository or the release zip

# From the repository:
git clone https://github.com/550AW/dsh-pdf-to-image
cd dsh-pdf-to-image

# Or from the release zip:
# unzip dsh-pdf-to-image-1.0.1.zip
# cd dsh-pdf-to-image-1.0.1

pnpm install --prod        # or: npm install --omit=dev

Then point DSH's plugin manager at that directory. In a DSH session:

install the bundle at <absolute path to dsh-pdf-to-image>

The agent calls plugin_manager install_bundle, which links the package into the active profile and applies cordis.patch.yml. Restart DSH; pdf_to_image appears in the agent's tool list.

From the version-less tarball

Each Release also carries pdf-to-image.tgz, a version-independent npm tarball (the artifact awesome-list tarball links point at). Install it the same way — point the plugin manager at the downloaded file:

install the bundle at <path to pdf-to-image.tgz>

The plugin manager installs the package and its two npm dependencies (@hyzyla/pdfium and pngjs) for you, so this route needs no manual pnpm install.

Usage

Ask in natural language, or call the tool directly:

render pages 1-3 of report.pdf at 300 dpi into preview/

turn contract.pdf into images and show me the first page

Testing

node --test test/pdf-to-image.test.js

Four regression tests cover one normal render, a zero-area page rejection, a junction/symlink escaping the sandbox roots, and zero-padded page file names.

The code was also exercised with a 136-case adversarial suite (malformed and truncated PDFs, encrypted files, faked page trees, object/flate bombs, a malicious JS PDF, huge MediaBoxes, oversized page selections, DPI extremes, unusual output paths, preview edge cases, concurrent calls, and cancellation): 122 passed, 9 were informational behavioral probes, 5 witness cases became passing after the fixes, and 0 failed. No OOM, no crash, no stack-trace leak, and no write escaped the sandbox.

Files

index.js            tool schema, path resolution, sandbox fencing
lib/pdf.js          PDFium loading, page selection, rasterization
cordis.patch.yml    bundle patch: inserts the plugin row
package.json        dsh.bundle.patch points at the patch
pnpm-lock.yaml      pinned dependency tree
test/pdf-to-image.test.js   regression tests
docs/DETAIL.md      longer notes (English)
docs/DETAIL.zh.md   longer notes (中文)
locale/             plugin-page copy (en, zh)
icon.svg            plugin icon

Uninstall

Disable or remove the bundle pdf-to-image in the plugin manager. It keeps no state; rendered PNGs already on disk stay where they are.

Marketplace listing

This plugin is listed in awesome-dsh-plugin under the category tools:

Rasterize PDF pages to PNG images with one pdf_to_image tool, supporting page ranges, 24-600 DPI, output directories and optional inline previews.

The entry file lives in this repository as dsh-pdf-to-image.yml so the catalogue text stays reviewable next to the code; the copy submitted upstream is data/plugins/550AW__dsh-pdf-to-image.yml. Description changes start in that file.

License

MIT. Bundled dependencies keep their own licenses: both @hyzyla/pdfium (wrapper MIT; the PDFium WebAssembly build it ships is BSD-3-Clause, © The PDFium Authors) and pngjs are permissively licensed.

—/ 5

No ratings yet

Verified DSH bundle

Commit 6d6b36825fa6

Community comments

No comments yet. Be the first to write one.

DSH HUB

A community index for DSH plugins. Not an official GitHub or DeepSeek AI product.

CommunityResourcesAPIAbout