Repository navigation
feat!: render on Linux — remove the GDI+ dependency - #18
Merged
Merged
Conversation
|
Released as v3.0.0 — https://github.com/Tharga/Reporter/releases/tag/3.0.0 |
This branch had an error being deployed
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.
Fixes #17.
Rendering a template containing a
BarCodethrewDllNotFoundExceptionatGdiplusStartupon Linux, breaking member-card printing for a consumer that had moved to a Linux App Service. There was no configuration-level workaround.The report understated the problem
BarCode.Renderdid useSystem.Drawing— but so didImage.cs, and, decisively, PdfSharp 1.51's ownXImage.FromStreamandXFontfont resolution. Removing GDI+ from the element code alone would have produced a clean-looking fix that still crashed on Linux, one stack frame deeper.So this replaces the rendering stack rather than patching the elements.
What changed
System.Drawing.CommonGetDocumentbuilt an emptyDocumentwhose only job was counting pages; it is now aGetPageCountone-liner.ReporterFontResolverresolves registered fonts, then host-installed fonts, then an embedded fallback (fromPdfSharp.WPFonts, already in the MIT package). PDFsharp 6 Core resolves nothing on its own — not even on Windows — so this is required, and it is installed automatically.Image.csrebuilt onXImage, which also fixes theImageelement on Linux.XUnitimplicit conversions replaced with explicit.Point/XUnit.FromPoint.Verification
69 tests, 0 failures, identical on Windows and on Linux (WSL Ubuntu, .NET 10.0.11) — up from 50 tests with 6 running.
Render_never_touches_the_image_pathassertsDrawImageis never called — the regression guard for the Linux fix.%PDF-1.7, 3 pages, embedded font subset, zero image XObjects.PDFsharpandZXing.Net.The 4 tests skipped as "Can't gain access to internal stuff" were stale:
InternalsVisibleTo("Tharga.Reporter.Tests")was already present, and the real blocker was Moq's proxy generator, fixed here withInternalsVisibleTo("DynamicProxyGenAssembly2").Breaking changes — 3.0
PageFormat,RenderDataorDebugData. Consumers move toPDFsharp6.2.4 and renameXFontStyletoXFontStyleEx. Code that only builds templates and callsGetPdfBinaryis unaffected.ReporterFontResolver.Register.abc123produced a barcode that scanned as123anda-b.cscanned as-., with no error. Anything genuinely unencodable now throws. If any codes contain lower-case letters, the barcode they produce changes — worth checking against cards already in circulation.docs/articles/upgrading-to-3.mdcovers all three, anddocs/articles/fonts.mddocuments font resolution.https://claude.ai/code/session_016X21mvHXXY3DxS87J4Eh9V