Morph.Blazor.Pdf
1.35.0
dotnet add package Morph.Blazor.Pdf --version 1.35.0
NuGet\Install-Package Morph.Blazor.Pdf -Version 1.35.0
<PackageReference Include="Morph.Blazor.Pdf" Version="1.35.0" />
<PackageVersion Include="Morph.Blazor.Pdf" Version="1.35.0" />
<PackageReference Include="Morph.Blazor.Pdf" />
paket add Morph.Blazor.Pdf --version 1.35.0
#r "nuget: Morph.Blazor.Pdf, 1.35.0"
#:package Morph.Blazor.Pdf@1.35.0
#addin nuget:?package=Morph.Blazor.Pdf&version=1.35.0
#tool nuget:?package=Morph.Blazor.Pdf&version=1.35.0
Morph.Blazor.Pdf
PDF output for Morph.Blazor: adds PDF to the formats its converter and its editor write, entirely in the browser.
It is a package of its own because PDFs are written by Krilla, a
native library, and a WebAssembly app can only use one that is linked into its own .wasm. That makes the
app a native build, which needs the wasm-tools workload and adds about 4.7 MB to the runtime the browser
downloads (1.7 MB gzipped). An app that only views or edits documents references Morph.Blazor alone and has
none of it. Printing and the viewer's pages are not PDF, and need nothing from this package.
Install
dotnet add package Morph.Blazor.Pdf
Set up
Two things, in an app already set up for Morph.Blazor:
Add PDF to what Morph writes:
builder.Services.AddMorph(); builder.Services.AddMorphPdf();Make the app a native build, in its project file:
<PropertyGroup> <WasmBuildNative>true</WasmBuildNative> </PropertyGroup>with the workload installed, on CI too:
dotnet workload install wasm-toolsSet, a missing workload is a build error. Left unset, an app built without the workload builds with a warning, runs, and fails on its first PDF with "krilla_capi could not be loaded". With
WasmBuildNativeset tofalseit fails the same way, with no warning.
MorphConverter's picker and MorphEditor's File menu then offer PDF. In code, ConversionService.ToPdf and
BuildDownload write one, and ConversionService.WritableFormats has it. AddMorphPdf holds for the whole
process, as ConversionService does.
Coming from Morph.Blazor 1.33 and earlier
PDF was part of Morph.Blazor. Nothing has been renamed, so an app that writes PDFs takes the two steps above and changes no other code. An app that does not add this package:
- is not offered PDF by
MorphConverterandMorphEditor, andConversionService.WritableFormatshas no PDF in it.OutputFormat.Pdfis still there, andConversionService.Findstill describes it; - gets an
InvalidOperationExceptionnaming this package fromConversionService.ToPdf, and fromBuildDownloadwithOutputFormat.Pdf.MorphConvertershows it as an error whenInitialTargetorFormatsasks for PDF; - has no
Morph.Pdfthrough Morph.Blazor. Code callingPdfDocumentConverterorExportToPdfitself referencesMorph.Pdf; - needs no
wasm-toolsworkload on Morph's account, and can drop aWasmBuildNativeoffalsethat was there to keep Krilla out. Dropped, and with the workload installed, the SDK relinks a trimmed Release publish as it does any Blazor app's, which without Krilla makes the runtime smaller rather than larger; left in, the runtime is the SDK's own, 3.15 MB.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- Morph.Blazor (>= 1.35.0)
- Morph.Pdf (>= 1.35.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.