Skip to Content
NexPDF

Client libraries

Official NexPDF Cloud clients for TypeScript, Python, Go, Rust, PHP, .NET, Java, Ruby and Swift.

English

Every client has the same shape: create it once, call one method per endpoint, and get back a result you can save or read. They use only their language's standard library, retry rate limits and busy servers for you, and raise one error type with the API's error code.

LanguagePackageCreate the client
TypeScript / JavaScriptnpm @nexdevit/nexpdf-cloudnew NexPdfCloud()
PythonPyPI nexpdf-cloudNexPdfCloud()
Gogithub.com/nexdevit/nexpdf-cloud-gonexpdfcloud.New(nexpdfcloud.Options{})
Rustcrate nexpdf-cloudClient::from_env()?
PHPComposer nexdevit/nexpdf-cloudnew Client()
.NETNuGet Nexdevit.NexPdf.Cloudnew NexPdfCloudClient()
Java / KotlinMaven com.nexdevit:nexpdf-cloudNexPdfCloud.fromEnv()
Rubygem nexpdf-cloudNexPdfCloud::Client.new
SwiftSwiftPM NexPdfCloudtry NexPdfCloud.Client()

Install commands are on Get started.

For AI assistants, the MCP server (npm @nexdevit/nexpdf-cloud-mcp) is built on the TypeScript client.

Methods

EndpointTypeScriptPythonGo.NET
/v1/buildbuildbuildBuildBuildAsync
/v1/convert/pdfconvertToPdfconvert_to_pdfConvertToPDFConvertToPdfAsync
/v1/ocrocrocrOCROcrAsync
/v1/mergemergemergeMergeMergeAsync
/v1/extract/markdownextractMarkdownextract_markdownExtractMarkdownExtractMarkdownAsync
/v1/xlsx/editeditXlsxedit_xlsxEditXLSXEditXlsxAsync
/v1/docx/editeditDocxedit_docxEditDOCXEditDocxAsync
/v1/splitsplitsplitSplitSplitAsync
/v1/verifyverifySignaturesverify_signaturesVerifySignaturesVerifySignaturesAsync
/v1/healthhealthhealthHealthHealthAsync

Rust, PHP, Java, Ruby and Swift follow their own conventions with the same names (convert_to_pdf, convertToPdf, convertToPDF…). Each package's README lists them.

Files

Pass a path on disk, or bytes with a file name when the document is already in memory:

LanguageFrom a pathFrom bytes
TypeScriptfile('a.pdf')file(bytes, 'a.pdf')
Python"a.pdf"File.from_bytes(data, "a.pdf")
Gonexpdfcloud.Path("a.pdf")nexpdfcloud.Bytes(data, "a.pdf")
RustInput::path("a.pdf")Input::bytes(data, "a.pdf")
PHPFile::path('a.pdf')File::bytes($data, 'a.pdf')
.NETCloudFile.FromPath("a.pdf")CloudFile.FromBytes(data, "a.pdf")
JavaCloudFile.path("a.pdf")CloudFile.bytes(data, "a.pdf")
Ruby"a.pdf"NexPdfCloud::File.bytes(data, "a.pdf")
Swift.path("a.pdf").bytes(data, name: "a.pdf")

Results

A result holds the response body and what the API said about it: the content type, the units the request cost and its request id. save(path) writes it to disk; text() reads it as UTF-8 (for Markdown, HTML and JSON output).

Retries

The clients retry a request up to twice when the API answers 429 with rate_limited or concurrency_limited, 503, or when the network fails. They wait for Retry-After when the API sends one (at most 30 seconds), otherwise 0.5 s, then 1 s. Other errors are raised at once: retrying a bad request or an exhausted quota would not help.

Errors

Every failure raises one error type, with the HTTP status, the API's code, its message, the request id and retryAfter when the API sent one.

LanguageError type
TypeScript, Python, SwiftNexPdfCloudError
Go*nexpdfcloud.Error (use errors.As)
Rustnexpdf_cloud::Error
PHP, .NET, JavaNexPdfCloudException
RubyNexPdfCloud::Error

Errors the client finds before sending use the codes missing_api_key and invalid_request; a failed connection uses network. The API's codes are listed on Errors.

Source and tests

The clients live in the sdks/cloud folder of the NexPDF repository. All nine pass the same conformance scenarios against a mock of the API, and every sample on these pages is compiled and run against it before the site is published.

On this page