Text to PDF is a simple and efficient tool that converts plain text into a polished PDF document. It allows users to easily turn notes, letters, reports, or any written content into a professional-looking PDF file with consistent formatting. The tool supports various text styles, page layouts, and formatting options, ensuring that the final document is clear, organized, and ready for sharing or printing. With quick processing and an easy-to-use interface, Text to PDF provides a convenient way to create high-quality PDF documents from any text input.
Try it in Live Tool| Feature | Us | Other APIs |
|---|---|---|
| Credit-Based Pricing | Yes | Limited or confusing |
| Transparent Billing | Yes | Surprise charges |
| Dev-Focused Docs | Yes | Sparse examples |
| Free Credits | Yes | Paywall from day 1 |
| Fast Support | Yes | 3+ day wait time |
This example will sign your document with a Nutrient certificate.

Sign up and receive 100 credits for free, or log in to automatically add your API key to sample code. If you are not sure how credits are consumed read more in our pricing documentation , or check out this guide on calculating credit usage.

Add a PDF named document. pdf to your project folder. You can use our sample document.

Copy the code and run it from the same folder you added the files to. For more information, see our language-specific getting started guides.

Open result.pdf in your project folder to view the results.
curl -X POST "https://api.skynyx.dev/v1/txt_to_pdf" -H "apiKey: your_default_api_key" -F "text=Your text content here" -o result.json # JSON 'result' contains PDF locationcurl -X POST https://api.skynyx.dev/v1/txt_to_pdf ^
-H "apiKey: your_default_api_key" ^
-F "text=Your text content here" ^
-o result.json # JSON 'result' contains PDF locationimport java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import okhttp3.*;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class Program {
public static void main(String[] args) throws IOException {
OkHttpClient client = new OkHttpClient();
RequestBody requestBody = new MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("text", "Your text content here")
.build();
Request request = new Request.Builder()
.url("https://api.skynyx.dev/v1/txt_to_pdf")
.addHeader("apiKey", "your_default_api_key")
.post(requestBody)
.build();
try (Response response = client.newCall(request).execute()) {
if (response.body() != null) {
String responseBody = response.body().string();
JsonObject json = JsonParser.parseString(responseBody).getAsJsonObject();
if (json.has("status") && json.get("status").getAsInt() == 200) {
try (FileOutputStream outputStream = new FileOutputStream("result.json")) {
outputStream.write(responseBody.getBytes());
}
System.out.println("Response saved to result.json");
// The JSON 'result' contains the PDF location
System.out.println("PDF URL: " + json.get("result").getAsString());
} else {
System.out.println("API returned error: " + json.toString());
}
} else {
System.out.println("Empty response from server");
}
}
}
}const fs = require('fs');
const axios = require('axios');
const FormData = require('form-data');
async function main() {
const form = new FormData();
form.append('text', 'Your text content here');
try {
const response = await axios.post(
'https://api.skynyx.dev/v1/txt_to_pdf',
form,
{ headers: { ...form.getHeaders(), 'apiKey': 'your_default_api_key' } }
);
const data = response.data;
if (data.status === 200) {
fs.writeFileSync('result.json', JSON.stringify(data, null, 2));
console.log('Response saved to result.json');
// JSON 'result' contains PDF location
console.log('PDF URL:', data.result);
} else {
console.log('API returned error:', data);
}
} catch (error) {
console.error('Request error:', error.message);
}
}
main();using System;
using System.IO;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var apiUrl = "https://api.skynyx.dev/v1/txt_to_pdf";
using var client = new HttpClient();
using var form = new MultipartFormDataContent();
form.Add(new StringContent("Your text content here"), "text");
client.DefaultRequestHeaders.Add("apiKey", "your_default_api_key");
var response = await client.PostAsync(apiUrl, form);
var responseBody = await response.Content.ReadAsStringAsync();
var json = JsonSerializer.Deserialize<JsonElement>(responseBody);
if (json.GetProperty("status").GetInt32() == 200) {
await File.WriteAllTextAsync("result.json", responseBody);
// JSON 'result' contains PDF location
Console.WriteLine("PDF URL: " + json.GetProperty("result").GetString());
} else {
Console.WriteLine("API returned error: " + responseBody);
}
}
}import requests
import json
url = "https://api.skynyx.dev/v1/txt_to_pdf"
headers = {"apiKey": "your_default_api_key"}
data = {"text": "Your text content here"}
response = requests.post(url, headers=headers, data=data)
if response.status_code == 200:
json_data = response.json()
if json_data.get("status") == 200:
with open("result.json", "w") as out_file:
json.dump(json_data, out_file, indent=2)
print("Response saved to result.json")
# JSON 'result' contains PDF location
print("PDF URL:", json_data.get("result"))
else:
print("API returned error:", json_data)
else:
print("HTTP request failed with status:", response.status_code)<?php
$url = 'https://api.skynyx.dev/v1/txt_to_pdf';
$apiKey = 'your_default_api_key';
$ch = curl_init();
$postFields = ['text' => 'Your text content here'];
$headers = ['apiKey: ' . $apiKey];
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
file_put_contents('result.json', $response);
echo "Response saved to result.json
";
// JSON 'result' contains PDF location
echo "PDF URL: " . json_decode($response, true)['result'];POST /v1/txt_to_pdf HTTP/1.1
Host: api.skynyx.dev
apiKey: your_default_api_key
Content-Type: multipart/form-data; boundary=----BOUNDARY
------BOUNDARY
Content-Disposition: form-data; name="text"
Your text content here
------BOUNDARY--
# Response: JSON, 'result' field contains PDF location