Aspose.CSS 26.11.0

Prefix Reserved
dotnet add package Aspose.CSS --version 26.11.0
                    
NuGet\Install-Package Aspose.CSS -Version 26.11.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.
<PackageReference Include="Aspose.CSS" Version="26.11.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Aspose.CSS" Version="26.11.0" />
                    
Directory.Packages.props
<PackageReference Include="Aspose.CSS" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Aspose.CSS --version 26.11.0
                    
#r "nuget: Aspose.CSS, 26.11.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Aspose.CSS@26.11.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Aspose.CSS&version=26.11.0
                    
Install as a Cake Addin
#tool nuget:?package=Aspose.CSS&version=26.11.0
                    
Install as a Cake Tool

Aspose.CSS for .NET

Aspose.CSS for .NET is a native .NET library that loads HTML documents, parses their CSS style sheets, resolves the cascade and lays the documents out without an external browser. Its Converter API turns an HTML file, string, stream or URL into PDF or PNG images: one image of the viewport, of the whole content, or of each printed page, with page setup, CSS media type, fonts and resource loading under your control.

Install

dotnet add package Aspose.CSS

or, in the Visual Studio Package Manager Console, Install-Package Aspose.CSS.

The package targets .NET 10 (net10.0) and .NET Standard 2.0 (netstandard2.0, for .NET Framework and the other .NET Standard 2.0 platforms).

Linux

Nothing beyond the .NET runtime's own prerequisites: the native Skia and HarfBuzz libraries the package brings need only libc, libm, libstdc++ and libgcc_s, so a minimal image (for example the official .NET runtime image) converts as it is; fontconfig, freetype and libpng are not needed.

Fonts

Text is drawn from the fonts you add (Configuration.Fonts) and the fallback fonts embedded in the package. A font family named in CSS is matched against those fonts only. When none of them covers a character (Chinese, Japanese, Korean, Thai or Arabic text, for example), the machine's installed fonts are the last fallback: the font files in the system and user font folders (on Windows %WINDIR%\Fonts and %LOCALAPPDATA%\Microsoft\Windows\Fonts; on Linux /usr/share/fonts, /usr/local/share/fonts, ~/.fonts and ~/.local/share/fonts; on macOS /System/Library/Fonts, /Library/Fonts and ~/Library/Fonts) are read directly, without fontconfig or the registry. The font is chosen by the character's script and the language of the text (the lang attribute), the way Chromium chooses, and one machine always gives the same result. Set FontSettings.UseSystemFonts to false for output that does not depend on the machine's fonts.

Examples

Convert an HTML file to PDF:

using Aspose.Css;
using Aspose.Css.Saving;

class Example
{
    static void Main()
    {
        var result = Converter.ConvertHTML("invoice.html", new PdfSaveOptions(), "invoice.pdf");
        Console.WriteLine(result.PageCount);
    }
}

Convert a stream to a stream, resolving relative links against a base URL (the streams stay yours):

using Aspose.Css;
using Aspose.Css.Saving;

class Example
{
    static void Main()
    {
        using var input = File.OpenRead("report.html");
        using var output = File.Create("report.pdf");
        Converter.ConvertHTML(input, "https://assets.example/", new PdfSaveOptions(), output);
    }
}

Write one print-resolution PNG per page:

using Aspose.Css;
using Aspose.Css.IO;
using Aspose.Css.Saving;

class Example
{
    static void Main()
    {
        var images = new ImageSaveOptions {
            Mode = ImageMode.PrintPages, HorizontalResolution = 300, VerticalResolution = 300,
        };
        images.Css.MediaType = MediaType.Print;
        Converter.ConvertHTML(HtmlSource.FromFile("report.html"), images, new PageFiles());
    }

    private sealed class PageFiles : ICreateStreamProvider
    {
        public Stream GetStream(OutputPart part) => File.Create($"page-{part.Index + 1}.png");

        public void Complete(OutputPart part, Stream stream, OutputOutcome outcome)
        {
            stream.Dispose();
            if (outcome != OutputOutcome.Completed) File.Delete($"page-{part.Index + 1}.png");
        }
    }
}

Licensing

Without a licence the library runs in evaluation mode, with evaluation limits and an evaluation mark in the output metadata. Apply a licence once per process with using Aspose.Css; and new License().SetLicense("Aspose.CSS.lic"); (a full or short file name or an embedded resource name; or set the ASPOSE_CSS_LICENSE environment variable to its path); licences are at https://purchase.aspose.com/.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
26.11.0 65 11/13/2026