What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
The reliable fix is to register an IFontResolver and ship the actual TTF or OTF files that your HTML and renderer request. In the cross-platform PDFsharp/PdfSharpCore build, the exception means the resolver returned no usable face for a requested family and style; it does not prove that the font name is universally invalid. Register the resolver before creating any XFont or calling PdfGenerator.GeneratePdf, and map normal, bold, italic and bold-italic faces explicitly.
What the exception actually means
PDFsharp throws InvalidOperationException("No appropriate font found.") when FontFactory.ResolveTypeface cannot obtain a face for the requested family/style combination. HtmlRendererCore can trigger that path through CSS, fallback rules, or its own diagnostic rendering. The failure is therefore a font-resolution failure, not a universal ban on a family such as Arial or Courier New.
A Linux or container deployment commonly exposes the problem because the Core build does not use the machine’s Windows font inventory. The application must provide the font data itself through an IFontResolver (or an equivalent resolver supplied by the application).
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →First check the package flavor and operating system
PDFsharp is distributed in Core, GDI+ and WPF flavors. The Core build is pure .NET 6/8 or .NET Standard 2.0 and runs on Windows, Linux and macOS. GDI+ and WPF builds are Windows-only and have different access to installed Windows fonts.
#1 Best Overall
| Build | Supported deployment | Font-discovery expectation | Typical choice |
|---|---|---|---|
| PDFsharp Core / PdfSharpCore | Windows, Linux, macOS and other .NET platforms | Assume host fonts are unavailable; provide files through a resolver | Console, web and container applications that must be portable |
| PDFsharp-GDI | Windows only | Can discover fonts through the Windows GDI environment | Windows-specific applications using GDI+ |
| PDFsharp-WPF | Windows only | Uses the WPF font environment | Windows desktop/WPF applications |
If the application is intentionally Windows-only, changing to the appropriate GDI+ or WPF package may be reasonable. That is a deployment decision, not a general HtmlRendererCore fix; you still need to check package compatibility and font redistribution rights. For reproducible Linux, Docker and Kubernetes builds, shipping the exact font files and resolving them in code is the safer approach.
Implement a resolver with real font bytes
The resolver has two responsibilities: translate a requested family plus bold/italic flags into a face name, and return the bytes for that face. The following example embeds four Tinos files in the assembly. Replace Tinos with a font whose license permits redistribution.
1. Add the font files to the project
Place these files under Fonts/:
Tinos-Regular.ttfTinos-Bold.ttfTinos-Italic.ttfTinos-BoldItalic.ttf
Mark each file as an embedded resource in the project file:
<ItemGroup>
<EmbeddedResource Include="Fonts/Tinos-Regular.ttf" />
<EmbeddedResource Include="Fonts/Tinos-Bold.ttf" />
<EmbeddedResource Include="Fonts/Tinos-Italic.ttf" />
<EmbeddedResource Include="Fonts/Tinos-BoldItalic.ttf" />
</ItemGroup>
If you copy files to the output directory instead, make the deployment step deterministic and load from a known absolute or application-base path. Do not rely on whatever fonts happen to be installed in a developer laptop or base container image.
Rank #2
2. Map every common style combination
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using PdfSharpCore.Fonts;
public sealed class TinosFontResolver : IFontResolver
{
private static readonly IReadOnlyDictionary<string, string> Faces =
new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
{
["Tinos|normal|normal"] = "Tinos-Regular",
["Tinos|bold|normal"] = "Tinos-Bold",
["Tinos|normal|italic"] = "Tinos-Italic",
["Tinos|bold|italic"] = "Tinos-BoldItalic"
};
public FontResolverInfo? ResolveTypeface(
string familyName, bool isBold, bool isItalic)
{
// Treat CSS aliases you control as the supplied family.
var family = familyName.Trim();
if (!family.Equals("Tinos", StringComparison.OrdinalIgnoreCase) &&
!family.Equals("Arial", StringComparison.OrdinalIgnoreCase) &&
!family.Equals("sans-serif", StringComparison.OrdinalIgnoreCase))
{
return null;
}
var key = $"Tinos|{(isBold ? "bold" : "normal")}|{(isItalic ? "italic" : "normal")}";
return Faces.TryGetValue(key, out var face)
? new FontResolverInfo(face)
: null;
}
public byte[] GetFont(string faceName)
{
var resourceName = faceName switch
{
"Tinos-Regular" => "YourAssemblyNamespace.Fonts.Tinos-Regular.ttf",
"Tinos-Bold" => "YourAssemblyNamespace.Fonts.Tinos-Bold.ttf",
"Tinos-Italic" => "YourAssemblyNamespace.Fonts.Tinos-Italic.ttf",
"Tinos-BoldItalic" => "YourAssemblyNamespace.Fonts.Tinos-BoldItalic.ttf",
_ => throw new InvalidOperationException($"Unknown face: {faceName}")
};
using var stream = Assembly.GetExecutingAssembly()
.GetManifestResourceStream(resourceName)
?? throw new FileNotFoundException(
$"Embedded font resource was not found: {resourceName}");
using var memory = new MemoryStream();
stream.CopyTo(memory);
return memory.ToArray();
}
}
Use the namespace that appears in your assembly’s manifest. If you are unsure, enumerate Assembly.GetExecutingAssembly().GetManifestResourceNames() during diagnosis and copy the exact resource name into the mapping.
3. Register once, before any font use
using PdfSharpCore.Fonts;
if (GlobalFontSettings.FontResolver == null)
{
GlobalFontSettings.FontResolver = new TinosFontResolver();
}
var pdf = PdfGenerator.GeneratePdf(html, PageSize.A4, 0);
Run the registration during application startup, before PdfGenerator.GeneratePdf, XFont construction, or any other document-rendering call. In a web application, do this once in startup rather than racing to assign the global setting from multiple requests.
Some package versions expose nullable annotations differently; remove the ? annotation if your compiler targets an API that declares a non-nullable return type. The essential behavior is unchanged: return a FontResolverInfo for supported requests and return null only when you deliberately reject or replace a family.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Make HTML and CSS use resolvable families
After installing a resolver, make the HTML explicit. A simple fallback chain is useful, but every family that can actually be selected must either be mapped or replaced.
<style>
body { font-family: Tinos, sans-serif; }
strong { font-weight: 700; }
em { font-style: italic; }
</style>
Do not inspect only the visible page CSS. Search templates, injected styles, component libraries and generated markup for every font-family. Also inspect renderer defaults and error paths. In a documented Linux/Docker failure, ImageRenderer.RenderFailureImage created an XFont("Courier New", 8); the application’s resolver had to cover Courier New as well. You can map that request to a supplied face, for example by accepting Courier New in ResolveTypeface and returning a metrically suitable bundled font, or ship a properly licensed Courier-compatible file and map all four styles.
Cover hidden requests and all style combinations
A resolver that handles only normal text can still fail when a heading is bold, an <em> element is italic, or a bold-italic combination occurs in a fallback path. Exercise these cases deliberately:
- Normal body text.
- Bold text and numeric
font-weight: 700. - Italic text and
font-style: italic. - Bold italic text.
- Every CSS fallback family.
- Missing-image and renderer-failure output.
- Any code that directly constructs
XFont.
Keep the face-name strings returned by ResolveTypeface exactly aligned with the names accepted by GetFont. A typo in that internal key produces the same apparent “no appropriate font” symptom even when the TTF files are present.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsDeployment and licensing checks
Containers and cloud hosts
Build the font files into the application image or assembly, verify that the published output contains them, and avoid paths that exist only in a development environment. Embedded resources remove a common working-directory problem. If using copied files, log the resolved path and fail with a message naming the missing file.
Rank #4
Font format and licensing
Use valid TTF or OTF files supported by your selected PDFsharp build. A web font license is not automatically a server/PDF redistribution license; retain the license notice and confirm that embedding and redistribution are permitted. Substituting a bundled family is technically possible, but it can change text metrics and pagination, so validate page breaks and line wrapping.
Global initialization
GlobalFontSettings.FontResolver is process-wide. Configure it once during startup and do not replace it per request. If another library has already assigned a resolver, merge the required mappings into that resolver or decide which resolver owns all families before rendering begins.
A practical troubleshooting sequence
- Capture the exact request. Read the exception and stack trace, then identify the family and whether the request is normal, bold, italic or bold-italic.
- Confirm the flavor. Record the PdfSharpCore/PDFsharp package, target framework and whether the process runs on Windows, Linux, macOS, Docker or Kubernetes.
- Inventory every source. Search HTML/CSS, fallback declarations, component templates, direct
XFontcalls and error-image code. - Verify the bytes. Confirm that each required TTF/OTF is embedded or copied to the published application and that its resource/path name is exact.
- Complete the mapping. Implement all four style combinations and any hidden families such as Courier New.
- Register early. Assign
GlobalFontSettings.FontResolverbefore the first font or HTML-rendering call. - Exercise failure paths. Render normal, bold, italic, bold-italic, fallback and missing-image cases in the same kind of environment used in production.
- Reconsider the package only when appropriate. A Windows-only application may evaluate GDI+ or WPF, but changing flavor does not solve missing files in a cross-platform deployment.
Common symptoms, causes and fixes
| Symptom | Likely cause | Fix |
|---|---|---|
| Fails only on Linux or Docker | Core build cannot see the developer’s installed Windows fonts | Bundle licensed font files and register an IFontResolver. |
| Normal text works; bold or italic fails | Only one style was mapped | Add normal, bold, italic and bold-italic entries and verify the boolean mapping. |
| Visible HTML uses a supported family, but an error image fails | Renderer default requests another family, often Courier New | Inspect the stack trace and map or replace that family. |
| Resolver is present but the exception remains | Registration occurred after the first XFont or resource name/face key is wrong |
Move registration to startup and log manifest names and requested face keys. |
Changing PdfPageMode.UseOutlines appears to help |
Anecdotal package-specific behavior, not a demonstrated font fix | Do not treat the page-mode change as a resolver solution; make every requested font resolvable. |
| Works locally, fails after publishing | Font files were not copied or embedded, or the working directory changed | Inspect the publish artifact and use embedded resources or an application-base path. |
About the HtmlRendererCore 1.0.1 report
A package-specific report records the exception at PdfGenerator.GeneratePdf(HTML, PageSize.A4, 0) with HtmlRendererCore.PdfSharpCore 1.0.1. One posted answer says that changing the call to use PdfPageMode.UseOutlines worked for that respondent, but it gives no diagnosis or version matrix. Treat it as an anecdotal workaround, not a general remedy. Available evidence does not establish that upgrading HtmlRendererCore.PdfSharpCore alone universally fixes the exception; resolver coverage remains the source-backed solution.
Free tools Windows power users keep installed
One-click scans. No signup required.
Or skip the browser setup
If what you actually need is a clean image or PDF of a web page for a report, test fixture or document pipeline, ScreenshotNeo provides a single HTTP request rather than a locally managed browser. Its capture flow accepts cookie/consent banners before removing more than 60 known consent platforms, newsletter popups and chat widgets; each cleanup step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and billing status. It also offers an MCP server for AI agents, with take_screenshot, get_page_info and capture_pdf tools.
For API details and all options, see the ScreenshotNeo documentation.
Best Value
cURL
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Python
import requests
r = requests.get(
"https://api.screenshotneo.com/v1/shot",
params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
timeout=90,
)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)
Node.js
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const fs = await import('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));
Every plan includes the features: full-page lazy-image capture, CSS-selector element capture, dark mode, device presets or custom viewports, retina scale, PDF paper/margins/landscape/page ranges, HTML/CSS-to-image, custom CSS and JavaScript, click and wait controls, request/resource blocking, headers/cookies/user agent/Authorization, timezone and geolocation, transparent backgrounds, resizing, chosen-TTL caching, signed links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, usage API and OpenAPI support. Pricing is Free for 1,000 shots per month with no card; Starter is $5 for 3,000, Growth $15 for 15,000, Pro $39 for 60,000, Scale $99 for 250,000 and Business $249 for 1,000,000. Yearly billing provides two months free. Create a free ScreenshotNeo account to get the 1,000 monthly shots without a card.
FAQ
Do I need to install fonts on the server?
Not when using the Core build with a resolver. Embedding or deploying the licensed files with the application is more predictable than relying on host installation.
Recommended Free Tools
Can I return one fallback face for every style?
You can, but bold and italic styling may be simulated or lose the intended metrics. Supplying distinct faces for all four combinations is safer for layout fidelity.
Why does the same HTML succeed on Windows?
A Windows GDI+ or WPF environment may discover installed fonts that a Core deployment on Linux or macOS cannot. The package flavor and host, not just the HTML, determine discovery behavior.
Is a missing font always the CSS family’s fault?
No. Renderer defaults, fallback styles, diagnostic images and direct XFont calls can request a different family than the visible CSS.
Frequently Asked Questions
Can I use system fonts with PdfSharpCore on Linux?
Do not depend on them for a reproducible Core deployment. Ship the required font files and resolve them explicitly.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →What should I log when diagnosing this exception?
Log the requested family, bold/italic flags, selected face name, assembly resource name or file path, package flavor and operating-system/container details.
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.

