Weasyprint.Wrapped 2.0.0

.NET Standard 2.0
NuGet\Install-Package Weasyprint.Wrapped -Version 2.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
dotnet add package Weasyprint.Wrapped --version 2.0.0
<PackageReference Include="Weasyprint.Wrapped" Version="2.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Weasyprint.Wrapped --version 2.0.0
#r "nuget: Weasyprint.Wrapped, 2.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Weasyprint.Wrapped as a Cake Addin
#addin nuget:?package=Weasyprint.Wrapped&version=2.0.0

// Install Weasyprint.Wrapped as a Cake Tool
#tool nuget:?package=Weasyprint.Wrapped&version=2.0.0

build-test-code-scan

Introduction

Wrapper around the weasyprint library which allows you to print html to a pdf file. This package does not require any external software or packages to be installed in order to use weasyprint.

Getting started

Installation

NuGet Badge

dotnet add package Weasyprint.Wrapped

Usage

You might want to provide the printer class using your DI Container.

  1. Initialize
    This will unzip the needed asset, it is best done during startup procedure. The printer will check if the asset is already unzipped, so the process is only done once (or when the package is upgraded and the version changed).
await new Printer().Initialize();
  1. Print
await new Printer().Print("<html><body><h1>TEST</h1></body></html>");

Warning

This is a large package, try to limit the projects where it will be installed.

  • +-104 MB zipped resource (standalone python, gtk3 for windows and weasyprint) which will be unzipped on initialization in the same folder (for windows).
  • +-89.7 MB zipped resource (standalone python and weasyprint) which will be unzipped on initialization in the same folder (for linux).

Extra resources

Thanks to all these great repos and the guys maintaining them!!!

Contribute

Create test package and run example

Windows:

.\build-on-windows.ps1

Linux:

.\build-on-linux.ps1

Create package:

cd .\src\Weasyprint.Wrapped\
dotnet pack -p:PackageVersion=0.0.[[NUMBER HERE]] --output nupkgs

Update the example project package version (Weasyprint.Wrapped.Example.csproj) and run the example to test it

Building assets

Windows (build-on-windows.ps1 does approximately this)

$Env:PATH += ";C:\weasyprint.wrapped\standalone-win-64\gtk3\bin"
  • Install weasyprint in the standalone python
cd c:\weasyprint.wrapped\standalone-win-64\python
.\python.exe -m pip install weasyprint
.\python.exe -m weasyprint --info

Linux (build-on-linux.ps1 does approximately this)

cd c:\weasyprint.wrapped\standalone-linux-64\python\bin\
python3 -m pip install weasyprint
python3 -m weasyprint --info

Help

  • Check PATH in python
.\python.exe -c "import os; print(*os.environ['PATH'].split(os.pathsep), sep='\n')"
Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.0 1,223 7/8/2022
1.0.9 3,524 5/26/2022