pdf
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data β all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v11View latest version
The backend provides RESTful API endpoints for PDF processing operations.
All API endpoints are prefixed with /api/pdf/
Merge multiple PDF files into one.
- Body: FormData with multiple
file0,file1, etc. fields - Response: PDF file download or JSON error
Split a PDF into specific pages or page ranges.
- Body: FormData with
file0andoptions(JSON string) - Options:
{ mode: 'pages'|'range', pages?: number[], startPage?: number, endPage?: number } - Response: PDF file download or JSON error
Convert PDF pages to images (info only - actual conversion requires additional libraries).
- Body: FormData with
file0andoptions - Options:
{ format?: 'png'|'jpg', dpi?: number } - Response: JSON with conversion info
Convert images to a PDF document.
- Body: FormData with multiple image files
- Response: PDF file download or JSON error
Compress a PDF file (basic compression by re-saving).
- Body: FormData with
file0 - Response: PDF file download or JSON error
Get PDF metadata and information.
- Body: FormData with
file0 - Response: JSON with PDF info
Add password protection to PDF (note: requires additional libraries).
- Body: FormData with
file0andoptions - Options:
{ password: string } - Response: JSON message (protection not fully implemented)
Rotate PDF pages by specified angle.
- Body: FormData with
file0andoptions - Options:
{ angle: 90|180|270, pages?: number[] } - Response: PDF file download or JSON error
All endpoints return JSON error responses with { success: false, message: string } format when errors occur.
- Maximum file size: 50MB per file
- Files are processed in memory and not stored permanently