Convert documents between PDF, Word, Excel, PPT, and image formats with high accuracy.
TypeSourceTargetExtensionpdf-to-wordPDFWord.docxpdf-to-excelPDFExcel.xlsxpdf-to-pptPDFPPT.pptxpdf-to-imagePDFImages (ZIP).zipword-to-pdfWordPDF.pdfword-to-imageWordImages (ZIP).zipexcel-to-pdfExcelPDF.pdfimage-to-pdfImage(s)PDF.pdfimage-to-wordImageWord (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 <file_path_or_folder> <target_format> [output_folder] (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:
bash
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
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:
bash
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
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:
bash
# 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 CodeMeaningSolution40003Insufficient balanceTop up at textin.com40101Missing auth headersCheck credentials40102Invalid credentialsVerify app ID and secret code40301Unsupported file typeCheck source file format40302File too largeMust be under 50MB40306Rate limitedWait before retrying, do NOT retry immediately
This skill requires the following system tools (typically pre-installed on macOS/Linux):
ToolPurposeVerifycurlHTTP requests to Textin APIcurl --version``python3JSON parsing & base64 decoding of API responsespython3 --version``base64Encoding 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:
DomainPurposeProtocolapi.textin.comDocument conversion APIHTTPS 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).
This skill handles format conversion only. For intelligent document content understanding and extraction, consider using the Textin xParse API which provides deep document parsing with structure recognition: