Generate PDFs in Python using a clean SDK designed for Django, Flask, and FastAPI apps. Convert HTML or URLs into PDFs that render with modern CSS.
import { GeneratePDFs } from '@generatepdfs/node-sdk';
const client = GeneratePDFs.connect('YOUR_API_TOKEN');
// Generate from HTML file with CSS
const pdf = await client.generateFromHtml(
'/path/to/file.html',
'/path/to/file.css'
);
// Or from a URL
const pdf = await client.generateFromUrl('https://example.com');
from generatepdfs import GeneratePDFs
client = GeneratePDFs.connect('YOUR_API_TOKEN')
# Generate from HTML file with CSS
pdf = client.generate_from_html(
'/path/to/file.html',
'/path/to/file.css'
)
# Or from a URL
pdf = client.generate_from_url('https://example.com')
<?php
use GeneratePDFs\GeneratePDFs;
$client = GeneratePDFs::connect('YOUR_API_TOKEN');
// Generate from HTML file with CSS
$pdf = $client->generateFromHtml(
'/path/to/file.html',
'/path/to/file.css'
);
// Or from a URL
$pdf = $client->generateFromUrl('https://example.com');
<?php
use GeneratePDFs\Laravel\Facades\GeneratePDFs;
// Generate from HTML file with CSS
$pdf = GeneratePDFs::generateFromHtml(
'/path/to/file.html',
'/path/to/file.css'
);
// Or from a URL
$pdf = GeneratePDFs::generateFromUrl('https://example.com');
require 'generatepdfs'
client = GeneratePDFs::GeneratePDFs.connect('YOUR_API_TOKEN')
# Generate from HTML file with CSS
pdf = client.generate_from_html(
'/path/to/file.html',
'/path/to/file.css'
)
# Or from a URL
pdf = client.generate_from_url('https://example.com')
Render templates in Django, Flask, or Jinja2 and send the HTML to the SDK. The browser based renderer keeps your CSS and fonts aligned with the web output. For HTML to PDF conversion, see the main guide. If you use WeasyPrint, see the Alternative to WeasyPrint.
Send a URL to the API to capture reports, receipts, or portal pages without managing headless browser processes.
Generate PDFs in Celery, RQ, or Dramatiq workers, then store the output in S3 or your storage layer. For CSS Grid and Flexbox support and pixel perfect HTML to PDF rendering, see our guides. Use the PDF generation API with the Python SDK.
GeneratePDFs.connect() for reuse.generate_from_html or generate_from_url from a view or task.Clean method names that fit Python service layers.
A hosted API avoids Chromium installs and system deps.
HTML and CSS render the same in the PDF.
Generate PDFs from Django templates and invoice data.
Create PDF exports from analytics dashboards and charts.
Produce large PDF batches in background workers.
Use the Python SDK to convert HTML or URLs into PDFs that keep your fonts, colours, and layout.