Quick Start
Get started with SyntaxDoc in under 5 minutes
Get your first PDF generated in under 5 minutes.
Create an Account
Sign up for a free account at syntaxdoc.com to get your API key. The free Hobby plan includes 100 conversions per month and 10 hosted PDFs.
Get Your API Key
Navigate to the Dashboard and create a new API key from the API Keys section.
Your API key will only be shown once when created. Store it securely - you won't be able to see it again!
API keys follow this format: sk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Make Your First Request
# Create a simple HTML file
echo '<h1>Hello World</h1>' > index.html
# Generate PDF
curl -X POST https://api.syntaxdoc.com/pdf/generate \
-H "X-API-Key: sk_live_your_api_key" \
-F "files=@index.html" \
-F 'options={"fileName": "hello", "format": "A4"}' \
--output hello.pdfconst formData = new FormData();
// Add HTML file
const htmlContent = '<h1>Hello World</h1>';
formData.append('files', new Blob([htmlContent], { type: 'text/html' }), 'index.html');
// Add options
formData.append('options', JSON.stringify({
fileName: 'hello',
format: 'A4',
margin: { top: '1cm', bottom: '1cm', left: '1cm', right: '1cm' }
}));
const response = await fetch('https://api.syntaxdoc.com/pdf/generate', {
method: 'POST',
headers: {
'X-API-Key': 'sk_live_your_api_key',
},
body: formData
});
const blob = await response.blob();
// Save or use the PDF blobimport requests
import json
# Prepare files and options
files = {
'files': ('index.html', '<h1>Hello World</h1>', 'text/html')
}
data = {
'options': json.dumps({
'fileName': 'hello',
'format': 'A4',
'margin': {'top': '1cm', 'bottom': '1cm', 'left': '1cm', 'right': '1cm'}
})
}
response = requests.post(
'https://api.syntaxdoc.com/pdf/generate',
headers={'X-API-Key': 'sk_live_your_api_key'},
files=files,
data=data
)
with open('hello.pdf', 'wb') as f:
f.write(response.content)Host Your PDF (Optional)
Want a shareable URL instead of downloading the PDF? Add host: true to your options:
formData.append('options', JSON.stringify({
fileName: 'hello',
format: 'A4',
host: true // Returns a URL instead of the PDF binary
}));
const response = await fetch('https://api.syntaxdoc.com/pdf/generate', {
method: 'POST',
headers: { 'X-API-Key': 'sk_live_your_api_key' },
body: formData
});
const { url, pdfId, expiresAt } = await response.json();
console.log(url); // https://api.syntaxdoc.com/api/hosted-pdfs/abc123Batch Generation
Need to generate multiple PDFs at once? Use batch generation with real-time progress tracking:
const response = await fetch('https://api.syntaxdoc.com/pdf/generate-batch', {
method: 'POST',
headers: {
'X-API-Key': 'sk_live_your_api_key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
documents: [
{ fileName: 'invoice-001', htmlContent: '<h1>Invoice 001</h1>' },
{ fileName: 'invoice-002', htmlContent: '<h1>Invoice 002</h1>' },
// Add as many as you need
],
stream: true, // Get real-time progress updates
host: true // Store as hosted ZIP file
})
});
const { batchId } = await response.json();
// Stream progress with SSE
const eventSource = new EventSource(
`https://api.syntaxdoc.com/pdf/progress/${batchId}/stream`
);
eventSource.addEventListener('progress', (event) => {
const { current, total } = JSON.parse(event.data);
console.log(`Generated ${current}/${total} PDFs`);
});
eventSource.addEventListener('complete', (event) => {
const data = JSON.parse(event.data);
const result = JSON.parse(data.message);
console.log('Download:', result.downloadUrl);
eventSource.close();
});Blazing Fast Performance - Our optimized engine uses browser reuse and parallel processing to generate 100+ PDFs in seconds!
Advanced Features
Add QR Codes
Generate QR codes automatically by adding data-qr attributes to your HTML:
<!DOCTYPE html>
<html>
<body style="text-align: center; padding: 40px;">
<h1>Certificate of Completion</h1>
<p>John Doe</p>
<div style="margin-top: 40px;">
<img data-qr="https://syntaxdoc.com/verify/cert-12345"
data-qr-size="200"
alt="Verification QR Code" />
</div>
</body>
</html>No separate API calls needed - QR codes are generated automatically during PDF creation!
Add Watermarks
Add text watermarks for branding or security:
formData.append('options', JSON.stringify({
fileName: 'confidential-report',
format: 'A4',
watermark: {
text: 'CONFIDENTIAL',
fontSize: 60,
opacity: 0.2,
rotation: -45,
color: { r: 1, g: 0, b: 0 }
}
}));Next Steps
- Learn about all available Options for customizing your PDFs
- Check out the complete API Reference
- See QR Code generation for certificates and tickets
- Add Watermarks for branding and security
- See real-world Examples including batch generation
- Understand Billing & Plans for usage limits