Repository navigation
Conversation
eXpl0it3r
force-pushed
the
feature/skiasharp
branch
2 times, most recently
from
November 15, 2026 14:37
6c7a4be to
21bf38d
Compare
- Render to an SKCanvas or SKImage, shape text with HarfBuzz - Generate paginated PDFs with SkiaSharp's PDF backend - Compare the regression samples against per OS pixel baselines - Pack the HtmlRenderer.SkiaSharp NuGet package in CI
eXpl0it3r
force-pushed
the
feature/skiasharp
branch
from
November 15, 2026 14:44
21bf38d to
79e230b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This adds
HtmlRenderer.SkiaSharp, a new adapter that renders HTML onto anySKCanvas, into anSKImageand into paginated PDFs, on Windows, Linux and macOS. It's the first adapter that isn't tied to Windows, and the PDF output doesn't need PdfSharp, so it could be a cross-platform successor for both the image and the PDF use cases.The adapter itself:
@font-faceandHtmlRender.AddFontFamilyfor fonts that aren't installed, and Liberation fonts as replacements for Arial, Times New Roman and Courier New on LinuxHtmlRender.RenderAsync,MeasureAsyncandRenderToImageAsync, the image size is limited to 4096 x 32768 without a max size, as Skia can't allocate anything much biggerPdfGenerator.GeneratePdfAsyncpaginates through the fragmentation tree, uses theprintmedia type, and turns links into PDF link annotations, internal anchors includedThe core only gets one change, a
MediaTypeper container, so the PDF generator can render withprintwhile images keepscreen, see the first commit.For the tests, there are unit tests for the rendering, the text shaping and the PDF generation, plus a pixel comparison of every demo sample against baseline images per OS. Skia's anti-aliasing differs by a few pixels between CPUs, so up to 64 differing pixels per image are accepted. The Linux baselines come from the Ubuntu runner, which has no CJK font, so the Korean and Japanese names in the Languages sample are boxes there.
Known limitations, all documented in the package README:
Rendering in parallel isn't thread safe yet, but that's in the core and affects every adapter, the shared pen, brush and font caches aren't locked. That will be a separate PR.
How to test this PR?
CI should succeed, and the Windows jobs should upload
HtmlRenderer.SkiaSharpin the NuGet artifacts. Additionally, check the generated PDFs in the PDF artifacts or run the quick start from the package README.