pdfporter
v0.1.0Convert files/URLs to PDF via conv2pdf; writes output files locally and deletes conversion jobs.
Files in, PDFs out — and PDFs reshaped. pdfporter is a client for the conv2pdf conversion service: it takes the path of a file on your computer, sends it for conversion, and writes the result back next to the original. Office documents, spreadsheets, presentations, images, e-books, PostScript and HTML files become PDFs; PDFs become Word documents or per-page images; and PDFs can be merged, split, page-extracted, rotated, numbered, watermarked, compressed, password-protected and unlocked.
Summary extracted from the README.
pdfporter
Files in, PDFs out — and PDFs reshaped. pdfporter is a client for the conv2pdf conversion service: it takes the path of a file on your computer, sends it for conversion, and writes the result back next to the original. Office documents, spreadsheets, presentations, images, e-books, PostScript and HTML files become PDFs; PDFs become Word documents or per-page images; and PDFs can be merged, split, page-extracted, rotated, numbered, watermarked, compressed, password-protected and unlocked.
Configuration
CONV2PDF_API_KEY(required for calls) — created in the conv2pdf dashboard, Developer tab. It is sent on every request asAuthorization: Bearer <key>. Without a key the server still starts and lists its tools; any tool call fails with a message explaining how to set the key.CONV2PDF_API_URL(optional) — API base URL. Defaults tohttps://api.conv2pdf.com/v1.CONV2PDF_TIMEOUT_MS(optional) — per-request timeout in milliseconds. Defaults to120000, because a conversion may legitimately take up to about a minute.
Tools
convert_to_pdf— convert a file to PDF, chosen from its extension: Word, Excel, PowerPoint, OpenDocument, Apple Pages, RTF, TXT and CSV files go through office-to-pdf; PNG, JPG, WebP, GIF and TIFF images through image-to-pdf; HEIC/HEIF photos through heic-to-pdf; EPUB through epub-to-pdf; PS/EPS through ps-to-pdf; HTML through html-to-pdf. An unknown extension fails locally, with no request made.convert_url_to_pdf— render a public web page to PDF from its address. It always takes anoutput_path, because there is no input file to write next to.convert_heic_to_jpg— an iPhone HEIC or HEIF photo as a JPG.convert_pdf_to_word— a PDF with real text as an editable DOCX document. Passpasswordto open a protected PDF.convert_pdf_to_images— one PNG (default) or JPG per page, delivered in a ZIP file.merge_pdfs— combine 2 to 20 PDFs into one, in the order given inpaths.extract_pdf_pages— copy the pages listed inranges(such as1-5,7,10-12) into a new PDF, in the order written.split_pdf— one PDF per page, in a ZIP file.rotate_pdf— turn every page byrotation: 90, 180 or 270 degrees.add_page_numbers— number the pages, as "3 / 12" (format: "full", the default) or "3" (format: "simple"), atpositionbottom-center (default), bottom-left or bottom-right.add_watermark— stamp atextof up to 50 characters on every page.compress_pdf— reduce the size, withqualitylow, medium (default) or high, keeping images at 72, 150 or 300 DPI.protect_pdf— set a newpassword(6 to 64 characters), withprevent_printandprevent_copyto forbid printing or copying.unlock_pdf— remove a password you know (pass it aspassword), or the printing and copying restrictions.get_quota— the plan, usage and limits of the API key, returned verbatim.
Most PDF-reading tools accept an optional password
that opens a protected PDF; the result has no password.
How a conversion behaves
- The input file is read locally and POSTed as
multipart/form-data to
<base>/convert/<api-tool>, the file in thefilefield plus the tool's fields as string fields. - On HTTP 429 or 503 the server waits for the delay
the API gives (the
Retry-Afterheader, else the body'sretry_afterseconds) and retries, at most twice and only for delays of 30 seconds or less. - The convert response carries a
job_idand a relativedownload_url; the result is downloaded from the API origin, written to disk, and the job is then deleted from the service on a best-effort basis.
Results are never overwritten. By default the output
sits next to the input: a conversion swaps the
extension (report.docx gives report.pdf), a PDF
operation adds a suffix (report.pdf gives
report-compressed.pdf for compress_pdf,
report-images.zip for convert_pdf_to_images, and so
on), and a merge writes merged.pdf next to the first
input. When the target name is taken, (2), (3),
... is appended before the extension until a free name
is found. With an explicit output_path, an existing
file there is refused before anything is sent.
A successful conversion answers with a JSON summary:
{"job_id": ..., "output_path": ..., "size_bytes": ...},
plus the quota object copied from the convert
response when the service sends one. get_quota
returns the service's response body verbatim.
Errors: a non-2xx reply fails with
conv2pdf error: <error> when the body carries an
error code, else conv2pdf error: HTTP <status>; an
unreachable API fails with conv2pdf unreachable.
CLI
Each tool is a subcommand taking one JSON argument string:
npx @reneturcios/pdfporter convert_to_pdf '{"path":"report.docx"}'
npx @reneturcios/pdfporter convert_url_to_pdf '{"url":"https://example.com/article","output_path":"article.pdf"}'
npx @reneturcios/pdfporter convert_heic_to_jpg '{"path":"IMG_0001.heic"}'
npx @reneturcios/pdfporter convert_pdf_to_word '{"path":"report.pdf"}'
npx @reneturcios/pdfporter convert_pdf_to_images '{"path":"report.pdf","format":"jpg"}'
npx @reneturcios/pdfporter merge_pdfs '{"paths":["a.pdf","b.pdf"]}'
npx @reneturcios/pdfporter extract_pdf_pages '{"path":"report.pdf","ranges":"1-5,7,10-12"}'
npx @reneturcios/pdfporter split_pdf '{"path":"report.pdf"}'
npx @reneturcios/pdfporter rotate_pdf '{"path":"scan.pdf","rotation":90}'
npx @reneturcios/pdfporter add_page_numbers '{"path":"report.pdf","position":"bottom-right"}'
npx @reneturcios/pdfporter add_watermark '{"path":"contract.pdf","text":"CONFIDENTIAL"}'
npx @reneturcios/pdfporter compress_pdf '{"path":"big.pdf","quality":"low"}'
npx @reneturcios/pdfporter protect_pdf '{"path":"confidential.pdf","password":"secret123","prevent_print":true}'
npx @reneturcios/pdfporter unlock_pdf '{"path":"protected.pdf","password":"secret123"}'
npx @reneturcios/pdfporter get_quota '{}'
npx @reneturcios/pdfporter --version
Exit codes: 0 on success, 1 on a runtime error,
2 on a usage error.
MCP server
npx -y @reneturcios/pdfporter mcp
MCP client config:
{
"mcpServers": {
"pdfporter": {
"command": "npx",
"args": ["-y", "@reneturcios/pdfporter", "mcp"],
"env": {
"CONV2PDF_API_KEY": "<your key>"
}
}
}
}
Docker
docker run -i ghcr.io/cloudcorprecords/pdfporter
docker run --rm ghcr.io/cloudcorprecords/pdfporter get_quota '{}'
Development
npm install
npm run build # tsc -> dist/
npm test # tsx --test test/*.test.ts (fake fetch only, no network)
npm run dev # run the CLI from source
License
MIT — Copyright (c) 2026 Rene Turcios