PDF to Structured Markdown Skill(ADP)

Other

A universal document parsing Skill powered by Laiye ADP (Agentic Document Processing) platform, outputting high-quality Markdown. ADP leverages large model capabilities to intelligently parse 10+ document formats including PDF, images, scanned documents, and Office files, automatically converting unstructured documents into Markdown format while fully preserving heading hierarchy, tables, lists, paragraph structure, and more. Zero-configuration and ready to use out of the box — ideal for structured document reading, content migration, technical documentation organization, and LLM context preparation.

Install

openclaw skills install adp-pdf-to-structured-markdown

PDF to Structured Markdown Skill

Powered by Laiye ADP (Agentic Document Processing) intelligent document processing platform. ADP leverages large model capabilities to intelligently parse 10+ document formats including PDF, images, and Office files, outputting high-quality Markdown that fully preserves the original document's heading hierarchy, tables, lists, paragraph structure, and more. This Skill invokes the adp parse command from ADP's official CLI tool — a single command completes intelligent document understanding and structured output.

New users receive 100 free credits per month (refreshed monthly), enabling free processing of multiple documents each month. ADP provides a standard commercial API that can be integrated into business systems within 1 hour. </br> Register now: Global | Mainland China


Quick Start Guide

Core Workflow

  1. Install dependencies: Install the ADP CLI tool on first run.
  2. Authentication setup: On first run, execute adp config get to check credentials. If not configured, prompt the user for their API Key.
  3. Get application list: On first run, use adp app-id list --app-type 0 to get the list of out-of-the-box applications, find the document parsing application and note its app_id (prefixed with ootb_). For subsequent runs, prefer adp app-id cache.
  4. Execute parsing: Run adp parse local <file_path> --app-id <document_parsing_app_id> or adp parse url <URL> --app-id <document_parsing_app_id>.
  5. Process results: The parsing result is returned as Markdown-formatted text, preserving the original document's headings, tables, lists, paragraphs, and other structural elements.
  6. Error handling: When a command fails, parse the stderr JSON to determine the error type and recovery action.

Supported Input Formats

Format TypeSupported File Extensions
PDF Documents.pdf
Image Files.jpg, .jpeg, .png, .bmp, .tiff, .tif
Office Documents.doc, .docx, .xls, .xlsx, .ppt, .pptx

Typical Use Cases

ScenarioDescription
Technical Documentation Migration & OrganizationParse PDF-format technical manuals, API docs, and product specifications into Markdown for easy import into Wiki, GitBook, Notion, and other knowledge management platforms
LLM Context PreparationParse unstructured documents into Markdown text as input context for large language models, improving AI comprehension and Q&A quality
Content Publishing & Format ConversionParse Word, PPT, and PDF reports into Markdown for direct use in blog publishing, documentation site generation, or CMS content entry
Historical Archive DigitizationParse scanned documents and image-format historical materials via OCR into editable Markdown text for easy retrieval and reuse

Scenario → Command Mapping

Single File Parsing

User IntentRecommended Command
Convert a local PDF to Markdownadp parse local <file_path> --app-id <document_parsing_app_id>
Convert a remote PDF/image to Markdownadp parse url <URL> --app-id <document_parsing_app_id>
Convert a Base64-encoded document to Markdownadp parse base64 <base64> --app-id <document_parsing_app_id> --file-name <filename.ext>

Batch Parsing

User IntentRecommended Command
Batch convert documents in a local folderadp parse local <folder_path> --app-id <document_parsing_app_id>
Batch convert multiple remote URL documentsadp parse url <url_list_file> --app-id <document_parsing_app_id>

Async Processing

User IntentRecommended Command
Async parse a large fileadp parse local <file_path> --app-id <document_parsing_app_id> --async
Async batch parseadp parse local <folder_path> --app-id <document_parsing_app_id> --async
Query async task resultsadp parse query <task_id>

Concurrency limit: Free users support up to 2 concurrent document processing; paid users support up to 10


Step 1: Install ADP CLI

# Method 1: npm (Recommended, cross-platform)
npm install -g @laiye-adp/agentic-doc-parse-and-extract-cli
# Method 2: Shell script (Linux / macOS, when npm is not available)
curl -fsSL https://raw.githubusercontent.com/laiye-ai/adp-cli/main/scripts/adp-init.sh | bash
# Method 3: PowerShell script (Windows, when npm is not available)
irm https://raw.githubusercontent.com/laiye-ai/adp-cli/main/scripts/adp-init.ps1 | iex

Or download pre-compiled binaries from GitHub Releases.


Step 2: Get API Key & Authentication Setup

1. Access the ADP Portal for Credentials

We provide separate public cloud access URLs for domestic and international users. Using the nearest region ensures faster and more stable API calls.

RegionLogin URLAPI Base URL
Internationalhttps://adp-global.laiye.com/https://adp-global.laiye.com/
Mainland Chinahttps://adp.laiye.com/https://adp.laiye.com/

2. Get API Key After Registration/Login

New users need to register for an ADP account first. Upon registration, you'll receive 100 free credits per month.

  • After logging in, click your profile avatar to access the API_Key entry.

3. Complete Authentication Setup

adp config set --api-key <your-api-key>
adp config set --api-base-url https://adp-global.laiye.com

4. Verify Configuration

adp config get

Notes:

  1. If API Key and API Base URL are already configured, it's recommended to store the configuration in environment variables to avoid repeated setup.
  2. If API Key and API Base URL are not yet configured, follow the steps above to complete the setup.

Step 3: Get the Document Parsing Application ID

ADP provides out-of-the-box built-in applications for document parsing — no additional configuration required.

Application Types

ADP applications are divided into two types, distinguished by the app_type field:

app_typeTypeDescription
0Out-of-the-box (OOTB)Platform built-in, app_id prefixed with ootb_, ready to use without creation
1Custom ApplicationUser-created extraction applications with custom app_id

Document parsing is an out-of-the-box application and can be queried with --app-type 0.

Query and Filter Document Parsing Applications

# Query only out-of-the-box applications (Recommended)
adp app-id list --app-type 0

# Or query all applications
adp app-id list

Find the application with app_label containing "Document Parsing" in the returned list, and note its app_id:

[
  {
    "app_id": "ootb_*********y2b4",
    "app_label": ["Document Parsing", "Image Extraction", "OCR", "Structured Parsing", "Batch Parsing"],
    "app_name": "Document Parse",
    "app_type": 0
  }
]

In the example above, "app_id": "ootb_******xx" is the document parsing application. app_type of 0 indicates an out-of-the-box application; 1 indicates a custom application.

Cache Application ID (Recommended)

After the first query, prefer using the cache to avoid repeated requests:

# Use cache for subsequent queries
adp app-id cache

Important: Each account's app_id is unique and fixed. Unless the user manually deletes the application, the app_id will not change. It's recommended to save the document parsing app_id in context for direct reuse.


Step 4: Execute PDF/Image to Markdown Conversion

Single File Parsing (Local File)

adp parse local ./document.pdf --app-id <document_parsing_app_id>

Single File Parsing (URL)

adp parse url https://example.com/document.pdf --app-id <document_parsing_app_id>

Single File Parsing (Base64)

adp parse base64 <base64_string> --app-id <document_parsing_app_id> --file-name <filename.ext>

Output Description

ADP document parsing returns Markdown-formatted text that fully preserves the original document's layout structure:

  • Heading Hierarchy: Automatically identifies H1-H6 heading levels and converts them to corresponding # markers
  • Tables: Automatically identifies tables and converts them to Markdown table syntax
  • Lists: Both ordered and unordered lists preserve their original format
  • Paragraphs: Body paragraphs preserve original segmentation and line breaks
  • Image Regions: Image positions are annotated (with OCR text if available)
  • Page Numbers: Multi-page documents are automatically annotated with page separators

Output Example

# Contract Agreement

## Chapter 1: General Provisions

**Party A**: Beijing XX Technology Co., Ltd.
**Party B**: Shanghai XX Trading Co., Ltd.

### 1.1 Purpose of Contract

This contract aims to clarify the rights and obligations of both parties in the software development project...

## Chapter 2: Service Scope

| No. | Service Item | Delivery Date | Amount (10K CNY) |
| --- | --- | --- | --- |
| 1 | Requirements Analysis | 2025-03-01 | 10.0 |
| 2 | System Design | 2025-04-01 | 15.0 |
| 3 | Development & Implementation | 2025-06-01 | 50.0 |

Step 5: Batch Processing & Async Mode

Batch Processing (Local Folder)

adp parse local ./documents/ --app-id <document_parsing_app_id> --export ./results/

Returns a summary:

{
  "total": 10,
  "success": 9,
  "failed": 1,
  "output_dir": "/absolute/path/to/results",
  "files": [
    {"input": "contract.pdf", "output": "contract.pdf.json", "status": "success"},
    {"input": "report.docx", "output": "report.docx.json", "status": "success"},
    {"input": "damaged.pdf", "output": "damaged.pdf.error.json", "status": "failed", "error": "..."}
  ]
}

Async Processing

# Submit async task
adp parse local ./large-document.pdf --app-id <document_parsing_app_id> --async

# Query task results
adp parse query <task_id>

Two-Phase Async (Batch + Resume)

# Phase 1: Submit tasks without waiting for results
adp parse local ./documents/ --app-id <document_parsing_app_id> --async --no-wait --export tasks.json

# Phase 2: Query results
adp parse query --watch --file tasks.json --export ./results/

Command Quick Reference

# Check installation
adp version

# View configuration
adp config get

# Query all application list
adp app-id list

# Query only out-of-the-box applications (app_type=0)
adp app-id list --app-type 0

# Use cached applications
adp app-id cache

# Check credit balance
adp credit

# PDF/Image to Markdown (local file)
adp parse local <file_path> --app-id <document_parsing_app_id>

# PDF/Image to Markdown (URL)
adp parse url <file_url> --app-id <document_parsing_app_id>

# PDF/Image to Markdown (Base64)
adp parse base64 <base64_string> --app-id <document_parsing_app_id> --file-name <filename.ext>

# Batch parsing
adp parse local <folder_path> --app-id <document_parsing_app_id> --export <output_path>

# Async parsing
adp parse local <file_path> --app-id <document_parsing_app_id> --async

# Query async results
adp parse query <task_id>

# Auto-retry on failure (max 2 retries)
adp parse local <file_path> --app-id <document_parsing_app_id> --retry 2

Error Handling

When a command fails, stderr outputs structured JSON:

{
  "type": "AUTH_ERROR",
  "message": "Authentication error: invalid API key",
  "fix": "Check your API key is correct and has not expired.",
  "retryable": false,
  "details": {"context": "parse"}
}

Exit Code Reference

Exit CodeMeaning
0Success
1General error
2Argument error
3Resource not found
4Permission/authentication error
5Conflict
6Partial failure (some succeeded, some failed in batch processing)

Credits & Billing

ItemDescription
Document parsing costCharged per page; refer to ADP portal for specific pricing
New user free quota100 credits per month, reset at the beginning of each month
Check balanceadp credit
Top-upLog in to the ADP portal: Global | Mainland China & HK/Macau/Taiwan

More Laiye ADP Document Processing Capabilities

PDF/Image to Markdown is just one of many out-of-the-box capabilities from Laiye ADP platform. ADP leverages large model capabilities to provide intelligent document processing solutions covering all document categories:

CapabilityDescriptionTypical Scenarios
Global Invoice/Receipt ExtractionAutomatically identifies and extracts 10+ key fields including invoice number, date, amount, tax, line items; supports multi-language and multi-currency invoicesCross-border settlement automation, expense reimbursement management
Domestic Ticket ExtractionRecognizes 30+ common Chinese tickets including VAT invoices, taxi receipts, train tickets, flight itineraries, fiscal invoices; supports multi-page/multi-ticket recognition and verificationDomestic ticket recognition, invoice verification
Order ExtractionSupports various purchase order formats; extracts order number, products, quantities, prices, logistics infoProcurement automation, supply chain integration
ID Card & Certificate ExtractionADP supports 11 types of commonly used Chinese documents: ID card, HK/Macau/Taiwan travel permit, Chinese passport, bank card, household register, driver's license, vehicle registration, vehicle qualification certificate, bank account permit, business licenseAccount opening review, compliance checks, batch certificate data entry
Document ParsingConverts PDF, images, and Office documents into structured data while preserving layout and hierarchyLong document analysis, contract review, knowledge extraction
Custom ExtractionCreate custom extraction applications with dedicated fields and recognition logic for non-standard documentsEnterprise-specific forms, industry-customized documents

All capabilities above can be invoked through the same ADP CLI tool, sharing the ADP API Key and credit system.

For full capabilities, visit:


Important Notes

  1. Data Integrity: When using ADP output, present the returned data as-is. Do not modify, add, or remove any content during the parsing process.
  2. API Key Security: Keep your API Key secure and avoid exposing it to unauthorized third parties.
  3. File Size Limit: Maximum 50MB per file.
  4. Supported Formats: .jpg, .jpeg, .png, .bmp, .tiff, .tif, .pdf, .doc, .docx, .xls, .xlsx, .ppt, .pptx
  5. Application ID Reuse: The document parsing app_id is unique and fixed per account. It's recommended to save it for direct reuse without querying each time.
  6. Markdown Quality: Parsing quality depends on the clarity and layout complexity of the original document. For best results, use high-resolution PDFs or scanned documents.

Support & Contact

Copyright © 2026 [Laiye Technology (Beijing) Co., Ltd.] All rights reserved.