enquire-mcp API reference - v4.0.0-rc.7
    Preparing search index...

    Function readPdf

    • Extract text from a PDF page-by-page, with optional page-range slicing and metadata.

      Image-only / scanned PDFs surface has_text: false with complete: true; page failures surface complete: false and explicit failure evidence. Lazy-loads pdfjs-dist (optional dep) so markdown-only users pay zero cost. A valid upper bound beyond the document is clamped. Non-finite, fractional, non-positive, inverted, or wholly out-of-document ranges are rejected.

      Parameters

      Returns Promise<ReadPdfResult>

      A ReadPdfResult with per-page text, full-text join, metadata, and original total_page_count.

      If path is empty, the file is missing or excluded, or pdfjs-dist is not installed.

      If path resolves outside the vault.

      // Read pages 1-5 of a long paper
      const r = await readPdf(vault, {
      path: "Papers/2024-rag-survey.pdf",
      pages: [1, 5],
      include_metadata: true
      });
      if (!r.has_text) console.log("Scanned PDF — try ocrPdf()");
      console.log(r.metadata?.title, r.full_text.slice(0, 200));