Render from Any Website
Convert any web page or URL into a PDF using the Posiboo API.
Render from Any Website
Generate PDFs from any publicly accessible website or web page. Perfect for creating PDFs from dynamic web content, documentation, dashboards, or reports.
Overview
The /v1/render/source endpoint accepts a URL and renders it as a PDF. This is useful when you want to capture web content without creating a custom template.
Authentication
All requests must include your API key in the x-api-key header:
x-api-key: your_api_key_hereYou can create and manage API keys in your dashboard.
Basic Usage
fetch("https://api.posiboo.com/v1/render/source", {method: "POST",headers: { "x-api-key": "<your-api-key>", "Content-Type": "application/json"},body: JSON.stringify({ source: "https://example.com/report"})}).then(response => { if (response.status === 202) { console.log("PDF rendering started successfully"); }}).catch(error => { console.error("Error:", error);});Request Parameters
Required Fields
source (string) - The full URL of the web page to render as a PDF. Must be publicly accessible.
Optional Fields
settings (object) - PDF generation settings (see Advanced Settings below).
Advanced Settings
Customize the PDF output with optional settings:
{"source": "https://example.com/report","settings": { "format": "A4", // Paper size: A4, Letter, Legal, Tabloid "orientation": "portrait", // portrait or landscape "margin": { "top": "20px", "right": "20px", "bottom": "20px", "left": "20px" }, "printBackground": true, // Include background colors/images "scale": 1.0, // Scale factor (0.1 to 2.0) "waitForSelector": ".content-loaded", // Wait for element before rendering "waitForTimeout": 5000, // Wait timeout in milliseconds "emulateMediaType": "screen" // screen or print}}Common Settings
format (string, default: A4) - Paper format: A4, Letter, Legal, Tabloid, A3, A5
orientation (string, default: portrait) - Page orientation: portrait or landscape
printBackground (boolean, default: true) - Include CSS backgrounds and images
scale (number, default: 1.0) - Page scale factor (0.1 to 2.0)
waitForTimeout (number, default: 0) - Milliseconds to wait before rendering
waitForSelector (string) - CSS selector to wait for before rendering
emulateMediaType (string, default: screen) - CSS media type: screen or print
Response
The endpoint returns HTTP 202 Accepted immediately, indicating that your PDF rendering job has been queued for processing.
HTTP/1.1 202 AcceptedThe PDF is rendered asynchronously in the background. When it's ready, you'll receive a webhook notification (see Webhooks below).
Webhooks
When your PDF is successfully rendered, Posiboo sends a webhook event to the URL you configured in your Webhooks settings.
Webhook Payload
{"event": "pdf.rendered","timestamp": "2024-10-01T12:00:00Z","data": { "jobId": "job_xyz789abc", "source": "https://example.com/report", "status": "completed", "pdfUrl": "https://cdn.posiboo.com/pdfs/xyz789.pdf", "downloadUrl": "https://api.posiboo.com/v1/pdfs/xyz789/download", "expiresAt": "2024-10-08T12:00:00Z", "renderTime": 2.45, "pageCount": 8}}Webhook Events
pdf.rendered - PDF was successfully generated and is ready for download.
pdf.failed - PDF rendering failed (includes error details and reason).
Configure your webhook endpoint in the Webhooks section of your dashboard.
Use Cases
Documentation Export
Convert documentation websites to PDFs:
{"source": "https://docs.example.com/guide","settings": { "format": "A4", "printBackground": true, "waitForSelector": ".docs-content"}}Dashboard Reports
Capture dashboards or analytics pages:
{"source": "https://app.example.com/dashboard?report=monthly","settings": { "format": "Letter", "orientation": "landscape", "waitForTimeout": 3000, "scale": 0.9}}Dynamic Content
Render pages with JavaScript-generated content:
{"source": "https://example.com/chart","settings": { "waitForSelector": "#chart-loaded", "waitForTimeout": 5000, "emulateMediaType": "screen"}}Error Handling
202 - Success - PDF rendering has been queued
400 - Bad Request - Missing or invalid source URL
401 - Unauthorized - Invalid or missing API key
403 - Forbidden - URL is not accessible or blocked
429 - Too Many Requests - Rate limit exceeded
500 - Server Error - Contact support
Common webhook failure reasons:
- URL not accessible: The source URL returned 404 or is behind authentication
- Timeout: Page took too long to load or selector was not found
- Invalid URL: Malformed URL or unsupported protocol
Limitations
- Public URLs Only - The source URL must be publicly accessible without authentication
- Timeout Limit - Pages must load within 30 seconds (including
waitForTimeout) - File Size - Rendered PDFs must be under 50MB
- Same Rate Limits - Subject to the same rate limits as template rendering
Tips for Best Results
- Wait for Content - Use
waitForSelectorfor pages with dynamic content - Optimize Load Time - Ensure your source page loads quickly
- Test Media Types - Try both
screenandprintmedia types to see which looks better - Scale for Fit - Use
scaleto fit wide content on standard paper sizes - Include Backgrounds - Enable
printBackgroundfor better visual fidelity
Security Considerations
- Only render URLs you trust
- Be aware that Posiboo servers will access and render the URL
- Don't send sensitive data in query parameters (use templates with data payloads instead)
- URLs may be logged for debugging purposes
Next Steps
- Render from Templates - For more control with custom templates
- Configure Webhooks - Get notified when PDFs are ready
- View Render Logs - Monitor your rendering jobs
- API Keys - Manage authentication