Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
Reliable HTML-to-PDF output starts when you treat the document as paginated print, not as a responsive web page. Set paper size and margins with @page, add a dedicated print stylesheet, make fonts and images available to the converter, and test the result in the renderer you plan to use. No renderer makes every screen layout paginate exactly as it appears in a browser.
Why HTML changes when it becomes a PDF
A browser lays out a web page in a continuous scrolling viewport. A PDF divides content into fixed pages. As Prince’s user guide puts it, “The major difference between formatting for the web and for PDF/Print is that PDF is paginated.” That change affects where content falls, how blocks split, and whether headers, footers, and page numbers appear.
The practical consequence is that a page that looks fine on screen is not necessarily print-ready. A flex or grid layout, a long table, or an image may fit the browser viewport but overflow, split awkwardly, or move to a later PDF page. Design and test the page as a sequence of sheets.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Build a print-ready HTML document
1. Set the page geometry
Use the CSS @page rule to define the sheet size, orientation, and margins. WeasyPrint’s documentation describes support for page geometry, page counters, and page-margin features. Pick dimensions and margins based on the document’s actual use: a report intended for ordinary paper may need different geometry from a landscape data sheet.
#1 Best Overall
@page {
size: A4 portrait;
margin: 20mm 18mm 22mm;
}
@media print {
body {
margin: 0;
color: #111;
font: 11pt/1.45 Arial, sans-serif;
}
}
This is a starting point, not a guarantee that every converter will render every CSS feature identically. If a section needs a different page size or orientation, investigate named pages supported by the renderer you select and test that transition in the output.
2. Separate print rules from screen rules
Put print-specific styles in @media print. Hide navigation, buttons, interactive controls, and decorative elements that exist only for on-screen use. Avoid carrying over fixed-position or viewport-dependent layouts without checking how they behave on a finite page.
@media print {
.site-nav,
.screen-only,
button {
display: none !important;
}
a {
color: inherit;
text-decoration: none;
}
h1, h2, h3 {
break-after: avoid;
}
figure, img {
max-width: 100%;
}
}
Whether to remove link styling is a document-design choice: links can remain visually marked if readers need to identify them on paper. WeasyPrint documents support for links in generated PDFs, but the conversion environment still needs to be able to resolve the page and its resources.
3. Keep layout and breaks predictable
Use explicit widths where the document needs stable columns, and test for overflow rather than assuming a screen layout will paginate well. Apply page-break controls selectively. A heading should generally stay with the paragraph that follows; a chapter or major section may begin on a fresh page. Avoid forcing every item onto its own page unless that is intentional.
@media print {
.chapter-start {
break-before: page;
}
.keep-together {
break-inside: avoid;
}
p {
orphans: 3;
widows: 3;
}
}
A block marked to avoid splitting may be moved to the next page if it cannot fit in the remaining space. If it is taller than an entire page, the renderer may still need to split or overflow it. Keep-together rules are most useful for modest blocks such as a short figure and caption, not long articles or oversized tables.
4. Use semantic structure
Use real headings, lists, tables, and captions rather than styling generic containers to look like them. Meaningful heading order also helps make the document navigable: WeasyPrint documents heading-based PDF bookmarks. If a document is long, descriptive headings make the resulting outline more useful than repeated labels such as “Section.”
Rank #3
5. Make fonts and assets available
The converter must be able to retrieve stylesheets, images, and font files from its runtime environment. Relative paths that work on your laptop may fail in a container, a serverless job, or a separate conversion worker. Check that the HTML base URL and asset paths resolve where conversion actually runs, and verify the fonts available to that environment.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
WeasyPrint documents font support and PDF features including links, bookmarks, and attachments. Do not assume that choosing a font in CSS means the intended font is present or embedded in the output. Inspect the PDF on a machine without your development fonts and confirm that glyphs, line wrapping, and special characters remain correct.
Choose a renderer for the document’s requirements
Prince and WeasyPrint are both dedicated HTML/CSS-to-PDF options, but the right choice depends on the output requirements and deployment environment. Prince’s documentation describes an application that converts HTML and XML to PDF using CSS, with generated content for page numbering, headers, and footers. WeasyPrint describes itself as a visual rendering engine for HTML and CSS that exports PDF.
Rank #4
| Consideration | Prince | WeasyPrint |
|---|---|---|
| Useful fit from the documented capabilities | Advanced paged-media typesetting, including generated page furniture such as numbering, headers, and footers. | Open-source or Python-centric automation that needs HTML/CSS-to-PDF output. |
| PDF-related features documented | CSS-based conversion of HTML and XML to PDF; generated content for page numbering, headers, and footers. | Page geometry, links, bookmarks, attachments, fonts, and PDF/A or PDF/UA variants. |
| What to check before choosing | CSS paged-media support for your layout, asset handling, deployment model, licensing cost, and whether you need JavaScript. | CSS paged-media support for your layout, asset handling, deployment model, and whether you need JavaScript. |
This is a capability-oriented comparison, not a reliability ranking: no authoritative comparative reliability benchmark is established here. Evaluate your real templates in each candidate engine, especially if they rely on JavaScript, unusual CSS, or intricate page furniture. Decide early whether the output must meet PDF/A archival or PDF/UA accessibility requirements; those targets can affect your renderer and configuration choices.
A practical conversion and review workflow
- Prepare the HTML and assets. Use semantic markup, print-specific CSS, and resource URLs that the conversion process can resolve.
- Set page rules. Specify
@pagesize, orientation, and margins. Define any section-specific page geometry only after checking that your chosen renderer supports it. - Convert with the selected engine. For a Python-centric workflow, WeasyPrint is one option; for advanced paged-media typesetting, assess Prince. Use the official documentation for the chosen installation and invocation method because deployment details vary.
- Inspect the PDF itself. Check page count and dimensions, clipped or missing content, font substitution, links, bookmarks, headers and footers, and the placement of every forced break.
- Test representative edge cases. Include a long table, large and small images, an unusual font or special characters, long headings, section breaks, widows and orphans, and content near the bottom of a page.
- Repeat in the production environment. A local preview does not prove that server-side fonts and assets resolve or that the deployed renderer uses the same configuration.
For a repeatable process, keep representative input documents as regression fixtures. Compare page count, page boundaries, and visual output after changing the HTML, CSS, fonts, renderer, or runtime environment. This catches layout changes that a successful conversion exit status cannot reveal.
Free tools Windows power users keep installed
One-click scans. No signup required.
Troubleshoot common PDF conversion failures
- Content is clipped or runs off the page: Check the page size, margins, fixed widths, and oversized elements. Reduce or constrain the offending content and inspect whether it has a safe break point.
- A heading is stranded at the bottom of a page: Add a selective
break-after: avoidrule to the heading, or keep it with the first following block. Confirm there is enough room for both; otherwise the pair should move to the next page. - A large block leaves a surprising blank area: A break-avoid rule can move the whole block to the next page when it does not fit. Apply that rule only to blocks small enough to fit in the page area.
- Images or styles are missing: Check the conversion process’s working directory, base URL, permissions, and network access. Test each asset path from the same runtime that performs conversion.
- Text wraps differently in production: Verify that the expected fonts are installed and available to the production renderer. Font fallback changes glyph widths, which can alter line wrapping and page breaks.
- Page numbers or headers do not appear: Confirm that the selected engine supports the page-margin and generated-content features used by your CSS, and check the syntax against that engine’s documentation.
- Bookmarks are unhelpful or absent: Use a meaningful, logically ordered heading hierarchy and verify the engine’s bookmark behavior in the generated PDF.
- A PDF/A or PDF/UA requirement is not met: Treat the standard as an explicit output requirement, not a cosmetic CSS setting. Select and configure a renderer that documents the relevant variant, then validate the resulting file against the target requirements.
Where ScreenshotNeo fits—and where it does not
ScreenshotNeo is a website screenshot API and MCP server, not a replacement for a dedicated paged-media renderer when you need precise print layout, page-break control, or a PDF/A or PDF/UA target. It can be useful when you need to capture a rendered web page or use its PDF output option. Its capture options include full-page screenshots, CSS-selector element capture, device and viewport settings, and PDF output. For PDF page size, margins, or page ranges, check the ScreenshotNeo documentation rather than assuming a browser screenshot workflow exposes the same controls as a dedicated HTML-to-PDF engine.
Best Value
Or skip the browser setup
If your immediate need is to capture a page rather than build a carefully typeset multi-page report, ScreenshotNeo makes a capture with one GET request. The example below saves a WebP capture of the documentation page; it demonstrates a screenshot call, not a print-layout conversion recipe. See the API documentation for supported output options and PDF-specific parameters.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://screenshotneo.com/docs/ -o shot.webp
- Cookie and consent banners are accepted like a visitor and more than 60 known consent platforms, newsletter popups, and chat widgets can be removed before capture; each of those steps can be turned off.
- Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing. Responses identify the page verdict and billing status in
X-Page-VerdictandX-Billedheaders. - An MCP server provides
take_screenshot,get_page_info, andcapture_pdftools for Claude, Cursor, and other MCP clients. - The free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots.
Sign up for ScreenshotNeo’s free plan: 1,000 screenshots a month, no card required.
Final checks before shipping a PDF
- Paper dimensions and margins match the intended use.
- Navigation and screen-only controls are removed from print output.
- Headings, tables, images, and page breaks remain readable across multiple pages.
- Fonts and external assets resolve in the deployed conversion environment.
- Links and bookmarks work, and any archival or accessibility target has been deliberately selected and checked.
Frequently Asked Questions
Should I use the same HTML for the screen and the PDF?
Usually the same semantic content can serve both, but use print-specific CSS to remove screen-only interface elements and control pagination.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesDoes a successful conversion mean the PDF is correct?
No. Conversion can complete even when assets are missing or content is clipped; inspect the generated pages and test representative documents.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

