PdfPig.Filters.Jbig2.PdfboxJbig2 0.1.12.1

UglyToad.PdfPig.Filters.Jbig2.PdfboxJbig2

Port to C# and PdfPig of the Java ImageIO plugin for the JBIG2 image format (see https://github.com/apache/pdfbox-jbig2).

Original port done by @kasperdaff as part of a PR for PdfPig, see https://github.com/UglyToad/PdfPig/pull/338 and then https://github.com/UglyToad/PdfPig/pull/631

Other filters

Usage

// Create your filter provider
public sealed class MyFilterProvider : BaseFilterProvider
{
    /// <summary>
    /// The single instance of this provider.
    /// </summary>
    public static readonly IFilterProvider Instance = new MyFilterProvider();

    /// <inheritdoc/>
    private MyFilterProvider() : base(GetDictionary())
    {
    }

    private static Dictionary<string, IFilter> GetDictionary()
    {
        var ascii85 = new Ascii85Filter();
        var asciiHex = new AsciiHexDecodeFilter();
        var ccitt = new CcittFaxDecodeFilter();
        var dct = new DctDecodeFilter(); // new filter
        var flate = new FlateFilter();
        var jbig2 = new PdfboxJbig2DecodeFilter(); // new filter
        var jpx = new JpxDecodeFilter();
        var runLength = new RunLengthFilter();
        var lzw = new LzwFilter();

        return new Dictionary<string, IFilter>
        {
            { NameToken.Ascii85Decode.Data, ascii85 },
            { NameToken.Ascii85DecodeAbbreviation.Data, ascii85 },
            { NameToken.AsciiHexDecode.Data, asciiHex },
            { NameToken.AsciiHexDecodeAbbreviation.Data, asciiHex },
            { NameToken.CcittfaxDecode.Data, ccitt },
            { NameToken.CcittfaxDecodeAbbreviation.Data, ccitt },
            { NameToken.DctDecode.Data, dct }, // new filter
            { NameToken.DctDecodeAbbreviation.Data, dct },
            { NameToken.FlateDecode.Data, flate },
            { NameToken.FlateDecodeAbbreviation.Data, flate },
            { NameToken.Jbig2Decode.Data, jbig2 },
            { NameToken.JpxDecode.Data, jpx },
            { NameToken.RunLengthDecode.Data, runLength },
            { NameToken.RunLengthDecodeAbbreviation.Data, runLength },
            { NameToken.LzwDecode.Data, lzw },
            { NameToken.LzwDecodeAbbreviation.Data, lzw }
        };
    }
}



var parsingOption = new ParsingOptions()
{
	UseLenientParsing = true,
	SkipMissingFonts = true,
	FilterProvider = MyFilterProvider.Instance
};

using (var doc = PdfDocument.Open("test.pdf", parsingOption))
{
	int i = 0;
	foreach (var page in doc.GetPages())
	{
		foreach (var pdfImage in page.GetImages())
		{
			Assert.True(pdfImage.TryGetPng(out var bytes));

			File.WriteAllBytes($"image_{i++}.png", bytes);
		}
	}
}

Showing the top 20 packages that depend on PdfPig.Filters.Jbig2.PdfboxJbig2.

Packages Downloads
PdfPig.Rendering.Skia
Render pdf documents as images using PdfPig and SkiaSharp.
1

.NET Framework 4.6.2

.NET Framework 4.7.1

.NET 6.0

.NET 8.0

.NET Standard 2.0

Version Downloads Last updated
0.1.12.1 1 11/16/2025
0.1.11 0 07/27/2025
0.1.11-alpha003 0 07/19/2025
0.1.11-alpha001 0 05/30/2025
0.1.10.2 0 03/15/2025
0.1.10.1 0 03/08/2025
0.1.10.1-alpha004 0 02/23/2025
0.1.10.1-alpha003 0 02/22/2025
0.1.10.1-alpha002 0 02/16/2025
0.1.10.1-alpha001 0 01/26/2025