Skip to content

document-extract fallback mode: "images" renders multi-page scanned PDFs to 1x1 pixels due to clawpdf 4M pixel budget #96389

Description

@cls3389

Environment

  • OpenClaw version: 2026.6.9
  • clawpdf version: 0.3.0

Problem
When document-extract processes a scanned/image-based PDF with multiple pages, text extraction returns empty, so it falls back to:

pdf.extract({ mode: "images", image: { maxPixels: 4000000, ... } })

clawpdf appears to enforce a hard 4,000,000 pixel render budget across the entire extraction. On multi-page 300dpi scans, later pages exhaust the budget and are rendered as 1x1 pixel images. This causes downstream vision models (e.g. dashscope/qwen-vl-ocr) to fail with:

InternalError.Algo.InvalidParameter: The image length and width do not meet the model restrictions. [height:1...]

Reproduction

  1. Send a multi-page scanned PDF (e.g. 13 pages, 300dpi) to OpenClaw.
  2. document-extract extracts 0 characters of text.
  3. Fallback mode: "images" returns 1x1 images for later pages.
  4. Vision model call fails.

Workaround
Replace the batch pdf.extract({ mode: "images" }) fallback with per-page rendering:

for (const pageNum of pageIndices) {
  const page = pdf.page(pageNum);
  const bytes = await page.png({ dpi: 150 });
  // ...
}

This avoids the shared budget and produces valid PNGs for all pages.

Suggested fix
Either:

  • Fix clawpdf's mode: "images" to reset/reuse the render budget per page, or
  • Change document-extract to use per-page page.png() rendering for the image fallback.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.no-staleExclude from stale automation

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions