Convert documents between PDF, Word, Excel, PPT, and image formats with high accuracy.
| Type | Source | Target | Extension |
|---|---|---|---|
| ------ | -------- | -------- | ----------- |
pdf-to-word | Word | .docx | |
pdf-to-excel | Excel | .xlsx | |
pdf-to-ppt | PPT | .pptx | |
pdf-to-image | Images (ZIP) | .zip | |
word-to-pdf | Word | ||
word-to-image | Word | Images (ZIP) | .zip |
excel-to-pdf | Excel | ||
image-to-pdf | Image(s) | ||
image-to-word | Image | Word (OCR) | .docx |
Follow these steps to handle a file conversion request:
From the user's request, identify:
If the user provides $ARGUMENTS, parse it as (e.g., report.pdf word or ./invoices/ excel ./output/).
Format aliases: "docx" → word, "xlsx" → excel, "pptx" → ppt, "jpg"/"jpeg"/"png"/"bmp" → image.
If the conversion is ambiguous or unsupported, inform the user of available options.
The Textin API requires x-ti-app-id and x-ti-secret-code. Credentials are passed only via environment variables (never as CLI arguments, to avoid exposure in process lists).
Check for credentials:
TEXTIN_APP_ID and TEXTIN_SECRET_CODEexport before running the scriptTell the user they can obtain credentials by signing up at https://www.textin.com/user/login and navigating to the console settings. See: https://docs.textin.com/xparse/api-key
Pricing: Free quota included on signup. Paid usage starts at 0.035 CNY per conversion. Details: https://www.textin.com/product/textin_conversion#Specifications
Setting credentials:
export TEXTIN_APP_ID="your_app_id"
export TEXTIN_SECRET_CODE="your_secret_code"
Single file mode:
Read or ls.image-to-pdf: multiple images can be provided (comma-separated paths).Batch mode (folder input):
ls..pdf files for pdf-to-word).Use the helper script at scripts/convert.sh (relative to this skill's directory):
bash "<skill_dir>/scripts/convert.sh" <conversion_type> <input_file_or_url> <output_path>
Credentials are read from TEXTIN_APP_ID and TEXTIN_SECRET_CODE environment variables. The script also validates file extensions and enforces the 50MB size limit before uploading.
Determine the output path:
report.pdf → report.docx).pdf-to-image and word-to-image: output is a .zip archive containing one image per page._converted or a number if needed.Example:
export TEXTIN_APP_ID="your_app_id"
export TEXTIN_SECRET_CODE="your_secret_code"
bash "<skill_dir>/scripts/convert.sh" pdf-to-word ./report.pdf ./report.docx
When the user provides a folder path, use scripts/batch_convert.sh:
bash "<skill_dir>/scripts/batch_convert.sh" <conversion_type> <input_dir> [output_dir]
Credentials are read from TEXTIN_APP_ID and TEXTIN_SECRET_CODE environment variables.
input_dir for files matching the source format of the conversion type.output_dir defaults to input_dir if not specified.Examples:
# Convert all PDFs in a folder to Word, output to same folder
bash "<skill_dir>/scripts/batch_convert.sh" pdf-to-word ./documents/
# Convert all PDFs to Excel, output to a different folder
bash "<skill_dir>/scripts/batch_convert.sh" pdf-to-excel ./invoices/ ./excel_output/
# Convert all images to PDF
bash "<skill_dir>/scripts/batch_convert.sh" image-to-pdf ./scans/ ./pdfs/
Single file mode — on success, tell the user:
Batch mode — on success, tell the user:
On failure, explain the error. Common issues:
| Error Code | Meaning | Solution |
|---|---|---|
| ----------- | --------- | ---------- |
| 40003 | Insufficient balance | Top up at textin.com |
| 40101 | Missing auth headers | Check credentials |
| 40102 | Invalid credentials | Verify app ID and secret code |
| 40301 | Unsupported file type | Check source file format |
| 40302 | File too large | Must be under 50MB |
| 40306 | Rate limited | Wait before retrying, do NOT retry immediately |
This skill requires the following system tools (typically pre-installed on macOS/Linux):
| Tool | Purpose | Verify |
|---|---|---|
| ------ | --------- | -------- |
curl | HTTP requests to Textin API | curl --version |
python3 | JSON parsing & base64 decoding of API responses | python3 --version |
base64 | Encoding image files for image-to-pdf | base64 --version |
No additional binaries or packages need to be installed.
This skill makes outbound HTTPS requests to a single, hardcoded domain:
| Domain | Purpose | Protocol |
|---|---|---|
| -------- | --------- | ---------- |
api.textin.com | Document conversion API | HTTPS only |
The API endpoint is constructed from a constant ALLOWED_API_HOST="api.textin.com" in the script — it cannot be overridden by arguments or environment variables.
TEXTIN_APP_ID, TEXTIN_SECRET_CODE) are read only from environment variables — never accepted as CLI arguments (avoiding exposure in process lists or shell history)..pdf for pdf-to-*).-maxdepth 1) — no recursive traversal.api.textin.com for server-side conversion.The shell scripts perform only:
curl POST requests to the hardcoded API endpointpython3 JSON parsing and base64 decoding of API responsesbase64 encoding for image-to-pdf input preparationNo downloaded content is ever executed. No eval, exec, or dynamic code generation is used.
Textin — a commercial document AI platform. See API documentation and privacy policy.
image-to-word uses OCR-based document restoration — it can recognize text, tables, and preserve layout from images.pdf-to-image and word-to-image return a ZIP archive with one image per page.image-to-pdf accepts multiple images in a single request (comma-separated file paths).共 1 个版本