PDF Generation SDKs
cloudlayer.io provides official PDF generation SDKs for JavaScript/TypeScript, Python, Go, Java, C#/.NET, PHP, Ruby, and Rust. Convert HTML to PDF, capture URLs as documents, and render templates from your application. Community SDKs are available for several other languages, and since all document generation is driven by a REST API, you can also integrate directly from any language that supports HTTP requests.
Official SDKs
| Language | Package | Source |
|---|---|---|
| .NET C# | NuGet | GitHub |
| Go | pkg.go.dev | GitHub |
| Java | Maven Central | GitHub |
| JavaScript / TypeScript | npm | GitHub |
| PHP | Packagist | GitHub |
| Python | PyPI | GitHub |
| Ruby | RubyGems | GitHub |
| Rust | crates.io | GitHub |
Community SDKs
The following community SDKs are available:
| Language | Repository | Package Manager |
|---|---|---|
| .NET F# | github.com/cloudlayerio/cloudlayerio-fsharp | NuGet |
Using the REST API Directly
The cloudlayer.io REST API can be called from any language. All you need is:
- Your API key (passed via the
X-API-Keyheader) - The ability to make HTTP POST requests with JSON bodies
- Base URL:
https://api.cloudlayer.io/v2
Quick Reference: API Endpoints
| Endpoint | Description |
|---|---|
POST /url/pdf | Convert a URL to PDF |
POST /url/image | Convert a URL to an image |
POST /html/pdf | Convert HTML to PDF |
POST /html/image | Convert HTML to an image |
POST /template/pdf | Generate a PDF from a template |
POST /template/image | Generate an image from a template |
GET /url/pdf | Simple URL to PDF (query params only) |
GET /url/image | Simple URL to image (query params only) |
cURL Example
curl --request POST \
--url https://api.cloudlayer.io/v2/url/pdf \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <YOUR-API-KEY>' \
--data '{
"url": "https://example.com",
"async": false
}'
JavaScript (Node.js / Bun / Deno)
const response = await fetch("https://api.cloudlayer.io/v2/url/pdf", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": "<YOUR-API-KEY>",
},
body: JSON.stringify({
url: "https://example.com",
async: false,
}),
});
const result = await response.json();
console.log(result.assetUrl);
Python
import requests
response = requests.post(
"https://api.cloudlayer.io/v2/url/pdf",
headers={
"Content-Type": "application/json",
"X-API-Key": "<YOUR-API-KEY>",
},
json={
"url": "https://example.com",
"async": False,
},
)
result = response.json()
print(result["assetUrl"])
Tip: Even if your language does not have a dedicated SDK, the REST API is straightforward to use. See the Authentication Examples, HTML Examples, and URL Examples for more language-specific code samples.