Playground Sign in Start free
Use case · PDF generation

PDF Generation API

Convert any web page to high-quality PDF documents programmatically. Full JavaScript rendering, viewport control, and reliable output for invoices, reports, compliance documentation, and content preservation.

No credit card required.
The challenge

The PDF generation challenge.

Converting web pages to PDF seems straightforward, but dynamic content, complex layouts, and authentication barriers make programmatic PDF generation a persistent engineering challenge.

Dynamic content not rendered
Simple HTML-to-PDF tools miss JavaScript-rendered content, interactive charts, and dynamically loaded data.
Broken CSS & layout
Complex CSS layouts, flexbox, grid, and media queries often break when converting to fixed PDF page formats.
Scaling & pagination issues
Content gets cut off at page boundaries, tables split awkwardly, and images overflow margins without proper handling.
Authentication walls
Pages behind login screens, paywalls, or cookie-based sessions require browser-level authentication to access.
Use cases

PDF generation use cases.

How businesses use automated PDF generation across industries.

Invoice & receipt archiving

Automatically convert online invoices, receipts, and billing statements into PDF documents for accounting and tax compliance. Scrape and archive invoices from supplier portals, SaaS dashboards, and e-commerce platforms on a schedule. Build a searchable document archive with consistent formatting regardless of the source.

Business outcomes
  • ✓Automate monthly invoice collection from 50+ vendor portals
  • ✓Reduce manual document processing time by 80%
  • ✓Maintain audit-ready document archives
  • ✓Ensure compliance with document retention requirements

Compliance documentation

Generate PDF snapshots of web content for regulatory compliance and legal evidence. Capture terms of service changes, privacy policy updates, advertising claims, and public disclosures as they appeared at specific points in time. Create immutable records for legal teams, regulators, and auditors.

Business outcomes
  • ✓Create timestamped records of regulatory disclosures
  • ✓Archive competitor advertising claims for legal review
  • ✓Support GDPR, CCPA and industry-specific record keeping
  • ✓Keep dated PDF records of web content for legal review

Report generation

Convert web-based dashboards, analytics reports, and data visualizations into distributable PDF documents. Generate weekly or monthly reports from tools like Google Analytics, Looker, and custom dashboards. Share insights with stakeholders who prefer PDF documents over live dashboards.

Business outcomes
  • ✓Automate weekly executive report generation
  • ✓Convert live dashboards to shareable PDF documents
  • ✓Schedule automated report delivery to stakeholders
  • ✓Archive historical performance data as PDF snapshots

Content preservation

Archive web articles, research papers, blog posts, and online documentation as PDF documents before they disappear or change. Build knowledge libraries from web content that may not persist. Preserve formatting, images, and layout in a portable document format that works offline.

Business outcomes
  • ✓Archive valuable content before it's removed or changed
  • ✓Build offline-accessible knowledge libraries from web sources
  • ✓Preserve research materials with original formatting
  • ✓Create distributable copies of online-only content
How it works

How PDF generation works.

Convert any web page to PDF in three steps.

1

Send a Scrape API request

Use the Scrape API with response_type=pdf and provide the target URL. Optionally configure viewport dimensions for the browser rendering, wait conditions to ensure dynamic content is loaded, and custom headers or cookies for authenticated pages. A single API call is all it takes.

2

Browser renders & converts

Ujeebu launches a headless Chromium browser, navigates to the URL, executes all JavaScript, waits for content to fully load, and converts the rendered page to PDF using Chrome's built-in PDF printing engine. This ensures perfect CSS rendering, proper fonts, and accurate layout in the output document.

3

Receive the PDF document

Get the PDF back as binary, or base64-encoded inside a JSON response with json=true. The PDF preserves all visual elements including images, charts, and styling.

Try it

Try PDF generation now.

Enter any URL to convert it to PDF in the playground.

curl -G "https://api.ujeebu.com/scrape" \
  -H "ApiKey: YOUR_KEY" \
  --data-urlencode url=https://stripe.com/pricing \
  -d js=true \
  -d response_type=pdf \
  --output capture.pdf
No API key required for testing. Powered by /scrape
Features

PDF generation features.

Full-page PDF

Generate PDFs that capture the entire page content, properly paginated and formatted. Long pages are automatically split across multiple PDF pages with intelligent page break handling to avoid cutting text or images mid-element.

Viewport control

Set the browser viewport with window_width and window_height before conversion, so responsive pages render at the layout you want. The PDF uses Chrome's default page format.

JavaScript execution

Full Chromium-based JavaScript rendering converts even the most complex SPAs and dynamic web applications to PDF. React, Vue, Angular, and any JavaScript framework is fully supported with complete DOM rendering.

Wait conditions

Wait for a specific selector, a number of milliseconds or a custom JavaScript condition (wait_for) before generating the PDF. Ensure charts are rendered, data tables are loaded, and all async content is present in the final document.

Scroll support

Set scroll_down=true (with js=true) to scroll through the page and trigger lazy-loaded content and infinite scroll sections before PDF generation. Capture the complete page content, not just what's initially visible.

Proxy support

Access geo-restricted or protected content with premium, residential or mobile proxies (proxy_type), with country targeting on premium proxies (proxy country is available on paid plans and top-up packs). Generate PDFs from publicly accessible web pages worldwide.

FAQ

Frequently asked questions.

Everything you need to know about our PDF endpoint.

What page sizes are supported for PDF output?▼
PDFs are generated by headless Chrome with its default page format. You can set the browser viewport with window_width and window_height; page size and margins are not exposed as parameters.
Can I convert pages with JavaScript frameworks to PDF?▼
Yes. Ujeebu uses a full Chromium browser to render pages before converting to PDF, so all JavaScript frameworks are supported including React, Vue, Angular, Next.js, and Svelte. Single-page applications, client-side rendered content, and interactive elements are all fully rendered before PDF conversion. You can use wait conditions to ensure all async data is loaded.
How do I handle pages that require login?▼
You can pass custom cookies and headers with your API request to authenticate with the target site. This allows you to convert pages behind login walls, session-based authentication, and cookie-gated content. For more complex authentication flows, you can use the JavaScript execution parameter to run custom login scripts before PDF generation.
What's the maximum page length for PDF generation?▼
Long pages are rendered into a multi-page PDF. For lazy-loaded or infinite-scroll pages, set js=true and scroll_down=true so content loads before conversion. Very long pages may need a higher timeout (the default is 60 seconds).
Can I generate PDFs from pages with anti-bot protection?▼
Often, yes. Set js=true and choose a stronger proxy with proxy_type=premium or residential. These cost more than the 10 credits a PDF costs on the default rotating proxy; the exact cost of each call is in the Ujb-Credits response header. Results on heavily protected sites vary.
Can I top up if I run out of credits?▼
Yes, on every plan, including the trial. Top-ups are fixed packs, from $12 for 50K credits ($0.24 per 1K) down to $0.13 per 1K at 5M credits, the same as on /pricing. Top-up credits last 60 days under 500K credits, 90 days from 500K and 180 days from 5M.
Get started with 5,000 free credits.
No credit card required.
Start free

Start generating PDFs today.

Convert any web page to a high-quality PDF with a single API call.

No credit card required.