Compress
Lossless and lossy PDF optimization using industry-standard Ghostscript profiles.
OCR Engine
Transforming scans into searchable documents via Tesseract (Swe/Eng support).
Visuals
Convert PDF pages and images, including AVIF, to WebP or PNG.
Secure
Use HMAC-SHA256 with file bytes for uploads or the URL string for JSON requests.
Implementation Guide
1. Upload a file
# Sign the raw file bytes
SIG=$(openssl dgst -sha256 -hmac "YOUR_KEY" "photo.avif" | awk '{print $2}')
curl -X POST https://pdf.tx.lk/index.php \
-H "X-Signature: $SIG" \
-F "pdf=@photo.avif" \
-F "task=webp" \
--output "converted.webp"
Send the file in the pdf field. Use a filename with the correct extension. For AVIF, use an .avif filename, not an extensionless temporary name.
2. Convert a public image URL
URL="https://example.com/photo.avif"
SIG=$(printf %s "$URL" | openssl dgst -sha256 -hmac "YOUR_KEY" | awk '{print $2}')
curl -X POST https://pdf.tx.lk/index.php \
-H "Content-Type: application/json" \
-H "X-Signature: $SIG" \
--data "{\"url\":\"$URL\",\"task\":\"webp\"}" \
--output "converted.webp"
The URL must use HTTPS and resolve to a public address. The service does not follow redirects.
3. Select a task
| Task | Engine | Output |
|---|---|---|
| compress | Ghostscript | Optimized PDF |
| ocr | Tesseract | Searchable PDF |
| webp or thumbnail | FFmpeg and cwebp | WebP image |
| png | FFmpeg or Ghostscript | PNG image |