Introduction¶
DeepSeek Harness (DSH) is built on the philosophy of “everything is a plugin.” Developers can mount various plugins in their local profile. When you need to turn photographed or scanned paper content into an editable, typeset PDF, the typical workflow is: first use an OCR tool to convert images into text, then format it in Word and export. This process requires switching between multiple tools and repeated export/import cycles, making it easy to mess up page order and figure placement.
This article introduces a DSH client plugin that lets you complete the entire pipeline—from “source image” to “typeset PDF”—directly within the Harness UI: import images or documents, transcribe them page by page with a vision model, automatically detect and crop figures, and finally generate a PDF with headings, lists, tables, and page numbers.
What It Is¶
dsh-scan-to-pdf is a DSH client plugin maintained by DogEgg-alR. It hands images / Word / PDF scans to a vision model for transcription, automatically identifies and crops figures, places them back in their original positions, and then generates a typeset PDF using python-docx + LibreOffice. The plugin runs entirely locally and does not pass data through any third-party service.
Core Features¶
- Import Source Files
Drag files into the panel, or click “Select Files.” Supported formats:
- Images: png, jpg, webp, gif — one image per page (max 20 MB each). On import, automatic preprocessing is applied: white-background compositing, contrast adjustment, and size normalization. Photos with a yellowed paper tint are color-corrected to white first.
- ZIP: After extraction, the images, Word files, and PDFs inside are sequentially converted into pages (other file types are skipped; the panel will tell you how many were skipped).
- Word: .docx / .doc files are converted to PDF via LibreOffice, then rendered page by page into images.
- PDF: Each page is rendered directly into an image. So text-only PDFs, scanned PDFs, and PDFs with embedded images can all be transcribed regardless of whether the content is text or images.
Click any page thumbnail to view the full-size original; press Esc or click outside to close. A single import supports up to 120 pages (for more, split into multiple tasks for more stable transcription).
- Page-by-Page Transcription
Select a model with image input capability, then click “Start Transcription.” The model reads each page and writes the content out as Markdown for saving. Each page can be edited independently; after making changes, click “Save This Page.”
- Figures Automatically Follow Along
Diagrams, apparatus drawings, hand-drawn sketches, and pasted photos on a page are recognized by the model during transcription — the model leaves a ![[fig:1]] placeholder in the body text and provides the figure’s bounding box (as a 0–1 proportional rectangle) at the end. The plugin crops the figure from the scanned page using that box, applies another pass of preprocessing (trimming white borders, boosting contrast, preserving line colors), resizes it to an appropriate size, and inserts it at the placeholder position.
If a figure is misidentified or unwanted, simply click “Delete” under the corresponding page. Re-transcribing that page replaces the figure set with newly detected ones, so they don’t accumulate. Figure captions prioritize the printed caption on the page; if none exists, one is generated from the figure’s content (e.g., “Figure 1 Round-bottom flask heating apparatus”), so the captions in the final PDF read naturally.
- Typeset into PDF
Write a title, pick a style (Notebook Green / Paper White / Warm Brown), optionally enable a cover page and table of contents, then click “Generate PDF.” The resulting PDF can be downloaded and also previewed at full size within the panel.
- Multi-Task
Click “New Task” at the top of the panel anytime to start a fresh one. New tasks are uniformly named “New Task” (with creation timestamps in the list, so they won’t be confused with old ones). Previous work stays in the “History” section below; click any entry to switch back and continue (the active one is labeled “Current”).
Typesetting is genuine Word layout followed by PDF conversion (python-docx → LibreOffice), not text pasted onto images: headings, lists, tables, blockquotes, code blocks, and page numbers are all properly formatted. Odd and even page numbers alternate left and right; tables drop vertical rules and keep only horizontal ones; body text is 10.5 pt with 1.45 line spacing.
Installation & Activation¶
Install directly from GitHub (web profile, command line):
dsh plugin --profile web add github:DogEgg-alR/dsh-scan-to-pdf
Or let DeepSeek Harness install it for you by sending it this message:
Install the plugin
github:DogEgg-alR/dsh-scan-to-pdffor me: use plugin_manager’s install_bundle with the parameter target set togithub:DogEgg-alR/dsh-scan-to-pdf. After installation, tell me whether the “Scan to PDF” tab on the plugin page requires a client restart to appear. Do not manually edit the profile’s package.json, and do not run pnpm by hand.
The desktop client (profile name desktop) is exclusively managed by the app while it’s running — the command line can’t modify it at that time. Use the message above to have Harness call the in-process pluginManager to install, or first install via a local directory:
C:\Users\ERAZER\.dsh\plugins\dsh-scan-to-pdf
install_bundle records an entry "dsh-scan-to-pdf": "link:…" in the profile (a junction in the case of a local directory), so subsequent file changes don’t require reinstallation. However, adding a new host half-route requires a full client quit and restart to take effect (client-side UI changes only need a page refresh).
Once installed, the Plugins page (Settings → Plugins) will show a new Scan to PDF tab.
Typical Workflow¶
- Open the plugin and drag in the file you want to transcribe (max 120 pages per import).
- Select a vision-capable model and click “Start Transcription.”
- The model outputs Markdown page by page, providing bounding boxes for any figures it detects.
- The plugin automatically crops figures and replaces placeholders. If a figure is misidentified, delete it and re-transcribe that page.
- Write a title, choose a style, click “Generate PDF,” and download.
Requirements¶
| Dependency | Notes |
|---|---|
| Vision model | Transcription requires a language model with image input. The plugin reads the current profile’s provider/model list and only lists models whose inputModalities includes image. |
| Python + python-docx | Used for docx typesetting, figure cropping/cleanup, and ZIP extraction. The plugin automatically locates the profile’s built-in runtime (<home>\.dsh\dsh-runtimes\dsh-primary-runtime\dependencies\python); if not found, it falls back to the path specified by DSH_SCAN_TO_PDF_PYTHON. |
| LibreOffice kit | For docx → PDF and PDF → preview images. Defaults to the client’s bundled @deepseek-ai/libreoffice-kit; can be overridden via DSH_SCAN_TO_PDF_SOFFICE. |
The panel header displays the readiness status of all three items (GET /dsh-scan-to-pdf/api/health).
File Storage¶
Each task gets its own directory: <profile>/.dsh-scan-to-pdf/jobs/<uuid>/
job.json Task status, per-page status and word count, figure list (caption / page / bounding box)
src/page-01.png Page images (already preprocessed on import)
figures/ab12cd.png Figures cropped from the pages
content.md Full transcribed Markdown (editable)
out/book.docx Intermediate typeset document
out/book.pdf Final PDF
out/preview-1.png First-page preview
All task data stays on your local machine and never passes through any third-party service. Transcription only sends images to the model you have configured yourself.
Use Cases & Caveats¶
Well suited for digitizing paper notes, lab reports, teaching materials, and similar content into editable PDFs. Handwriting recognition quality depends on the model; very messy handwriting may come out as □. Figure bounding boxes are occasionally off — deleting and re-transcribing usually fixes it.
The plugin runs with the permissions of the current DSH process. Review the source code and license (MIT) before installing.
In Short¶
dsh-scan-to-pdf consolidates the “scan → OCR → typeset” workflow into the DSH interface, reducing tool-switching and manual adjustments. It’s ideal for note-taking and document scenarios where you need to digitize large volumes of scanned content while keeping figure positions consistent.
- Directory: https://www.skillhub.cn/plugins/DogEgg-alR/dsh-scan-to-pdf
- GitHub: https://github.com/DogEgg-alR/dsh-scan-to-pdf