October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

How to Render Web Fonts in DocRaptor PDFs

Declare web fonts with CSS @font-face, make their files reachable to DocRaptor, and check pipeline support and the resulting PDF for the faces and glyphs you need.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use CSS @font-face to load a web font into the HTML DocRaptor converts, then apply the declared family to your text. The font file must be reachable by DocRaptor during rendering, and the account’s rendering pipeline must support its format. For WOFF2, DocRaptor specifies Pipeline 8 or newer.

Declare and apply the font in your HTML

Define the font with @font-face, including the family name, style, weight, and a URL for the font file. Then use that exact family name in the CSS rule for the text you want to render.

As an Amazon Associate I earn from qualifying purchases.

<style>
@font-face {
  font-family: "Open Sans";
  font-style: normal;
  font-weight: 400;
  src: url("https://fonts.example.test/open-sans-regular.woff2") format("woff2");
}
body {
  font-family: "Open Sans", Arial, sans-serif;
}
</style>

The URL above is illustrative, not a verified download location. Replace it with an accessible URL for a font you are licensed to use. DocRaptor’s custom font guide demonstrates an Open Sans WOFF2 URL hosted on fonts.gstatic.com; its tutorial shows the same general pattern with a fallback font.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Match the face to the text

A declaration for weight 400 and normal style describes that face only. If your document uses bold, italic, or other weights, add corresponding @font-face declarations with the same family name and the appropriate font-weight and font-style. Keep a fallback family in the CSS for characters or circumstances the chosen font does not cover.

Make the font file reachable during rendering

Use an absolute HTTPS URL for the font, or provide a base URL when your HTML uses relative asset paths. DocRaptor’s API reference documents a default external-resource fetch period of up to 10 seconds and a configurable timeout; a blocked, expired, slow, or inaccessible URL can prevent the renderer from loading the font.

For relative assets, the DocRaptor tutorial indicates that you can provide prince_options[baseurl] or use a <base> element. Put the CSS in the supplied HTML’s <style> block or in a stylesheet DocRaptor can access. The tutorial’s older Google Fonts example uses HTTP; prefer HTTPS for a current implementation.

Rank #2
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option

Submit the HTML to DocRaptor

The font CSS belongs in the HTML passed as document_content to the PDF API. This cURL example follows the documented submission pattern and uses test mode; supply your own API credentials and document content.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -X POST https://docraptor.com/docs 
  -u YOUR_API_KEY: 
  -d "doc[document_type]=pdf" 
  -d "doc[test]=true" 
  --data-urlencode "doc[document_content]=<html><head><style>@font-face{font-family:'Open Sans';font-style:normal;font-weight:400;src:url('https://your-domain.example/open-sans.woff2') format('woff2')}body{font-family:'Open Sans',Arial,sans-serif}</style></head><body>PDF sample</body></html>" 
  -o sample.pdf

Refer to DocRaptor’s custom-font tutorial and API reference for the current API parameters and account-specific configuration. This example demonstrates the request shape; it is not a claim that a particular font URL, account, or resulting PDF has been tested.

Check pipeline and font-format support

DocRaptor’s font guide says WOFF 2.0 requires Pipeline 8 or newer. DocRaptor’s Pipeline 8 release notes say that release added WOFF2 support with Prince 13. The API reference maps the documented pipelines to Prince versions as follows:

DocRaptor pipeline Prince version listed in API reference
10.1 15.1
10 15
9.2 14.3
9 14.1
8 13.5
7 12.5
6 11.4

These are the mappings in DocRaptor’s API reference; the pipeline configured for your account may differ from the latest available option. Check your account setting before diagnosing a format problem. DocRaptor recommends testing a newer version before changing the account default.

Rank #4
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers

What changes when upgrading

DocRaptor’s Pipeline 8 release notes state that Prince 13 changed line-height: normal to use the current font’s recommended value. If line spacing or pagination changes after a pipeline upgrade, test an explicit value such as line-height: 1.2, which the release notes say restores the previous behavior. This is a layout consideration, not a remedy for a font URL that fails to load.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Verify the PDF’s appearance and font coverage

A successful API response or a visible change in one paragraph does not establish that every intended font face and glyph is present. Generate a representative PDF and inspect the actual output. Include punctuation, accented characters, and every script your documents need, and check that a fallback is available where the font may lack coverage.

The API reference exposes prince_options[no_embed_fonts], which disables font embedding, and prince_options[no_subset_fonts], which disables font subsetting. For documents that must remain portable, inspect the resulting PDF’s font information and appearance rather than assuming that a CSS declaration guarantees embedding. Font coverage, licensing, and rendering success depend on the specific font and content; test those with the actual document.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot a font that does not appear

  1. Check the HTML: confirm the rendered document contains the @font-face rule and that the text references precisely the same family name.
  2. Check style and weight: confirm the text’s requested weight and style match a declared face; define additional faces when needed.
  3. Check the asset URL: open the URL independently, confirm it serves the expected font file over HTTPS, and ensure the rendering service can reach it within the resource-fetch period.
  4. Check format support: confirm the account’s pipeline supports the font format. For WOFF2, DocRaptor specifies Pipeline 8 or newer.
  5. Inspect a test PDF: compare the font’s appearance and representative glyphs, and verify embedding when portability matters.
  6. Investigate layout shifts separately: after a pipeline upgrade, check line height and pagination; Prince 13 changed the behavior of line-height: normal.

Or skip the browser setup

If your next step is capturing a rendered website rather than generating a DocRaptor PDF, ScreenshotNeo takes a screenshot with one GET request. It removes cookie banners, popups, and chat widgets before capture; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots, and 1,000 screenshots a month are free with no card; paid plans start at $5 for 3,000.

Example request (replace the URL with the page to capture):

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for request options. Sign up for 1,000 free screenshots a month, with no card required.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.