PDF // DOCUMENT ENGINE
Stateless API for document optimization, OCR and format conversion.
| Task | Input | Output | Engine |
|---|---|---|---|
compress | Ghostscript | ||
ocr | PDF/IMG | Tesseract | |
webp | PDF/IMG | WebP | cwebp / GS |
png | PNG | Ghostscript |
Optimizes PDF for web or ebook quality.
# Generate signature
SIG=$(openssl dgst -sha256 -hmac "YOUR_KEY" "doc.pdf" | awk '{print $2}')
# Send request
curl -X POST https://pdf.tx.lk/ \
-H "X-Signature: $SIG" \
-F "pdf=@doc.pdf" \
-F "task=compress" \
-F "quality=low" \
--output "compressed.pdf"
Renders the first page of a PDF as a PNG image.
SIG=$(openssl dgst -sha256 -hmac "YOUR_KEY" "doc.pdf" | awk '{print $2}')
curl -X POST https://pdf.tx.lk/ \
-H "X-Signature: $SIG" \
-F "pdf=@doc.pdf" \
-F "task=png" \
--output "preview.png"
Optimizes raw images to modern WebP format for web usage.
SIG=$(openssl dgst -sha256 -hmac "YOUR_KEY" "image.png" | awk '{print $2}')
curl -X POST https://pdf.tx.lk/ \
-H "X-Signature: $SIG" \
-F "pdf=@image.png" \
-F "task=webp" \
--output "result.webp"