A .NET library to render PDF files into images.
See the codeA .NET library for rendering PDF files as images.
PDFtoImage uses PDFium for rendering and SkiaSharp for images.
Render the first page of a PDF as PNG with PDFtoImage.Conversion:
using var pdf = File.OpenRead("document.pdf");
PDFtoImage.Conversion.SavePng(
imageFilename: "page1.png",
pdfStream: pdf,
page: 0);
SaveJpeg, SavePng, SaveWebp, and ToImage render a single page. ToImages and ToImagesAsync render multiple pages.
Dispose returned SKBitmap instances after use. To save one, use SKBitmap.Encode.
Window → Package Management → Package Manager.+ button (top-left corner) and select Install package from git URL....Install button:https://github.com/sungaila/PDFtoImage.git?path=etc/UnityPackage
PDFium is not thread-safe, so PDFtoImage serializes PDFium calls within each process. For parallel rendering on .NET 11 or later, use PDFtoImage.Parallel. It runs PDFium in separate worker processes; see the Parallel README for examples.
PolySharp provides System.Index and System.Range for .NET Framework projects. It also exposes the following generated types; avoid using them directly:
System.IndexSystem.RangeSystem.Diagnostics.CodeAnalysis.DoesNotReturnAttributeSystem.Diagnostics.CodeAnalysis.NotNullWhenAttributeSystem.Runtime.CompilerServices.IsExternalInitC#
90.0%
HTML
4.9%
Dockerfile
3.2%
CSS
1.1%
A .NET library to render PDF files into images.
See the codeA .NET library for rendering PDF files as images.
PDFtoImage uses PDFium for rendering and SkiaSharp for images.
Render the first page of a PDF as PNG with PDFtoImage.Conversion:
using var pdf = File.OpenRead("document.pdf");
PDFtoImage.Conversion.SavePng(
imageFilename: "page1.png",
pdfStream: pdf,
page: 0);
SaveJpeg, SavePng, SaveWebp, and ToImage render a single page. ToImages and ToImagesAsync render multiple pages.
Dispose returned SKBitmap instances after use. To save one, use SKBitmap.Encode.
Window → Package Management → Package Manager.+ button (top-left corner) and select Install package from git URL....Install button:https://github.com/sungaila/PDFtoImage.git?path=etc/UnityPackage
PDFium is not thread-safe, so PDFtoImage serializes PDFium calls within each process. For parallel rendering on .NET 11 or later, use PDFtoImage.Parallel. It runs PDFium in separate worker processes; see the Parallel README for examples.
PolySharp provides System.Index and System.Range for .NET Framework projects. It also exposes the following generated types; avoid using them directly:
System.IndexSystem.RangeSystem.Diagnostics.CodeAnalysis.DoesNotReturnAttributeSystem.Diagnostics.CodeAnalysis.NotNullWhenAttributeSystem.Runtime.CompilerServices.IsExternalInitC#
90.0%
HTML
4.9%
Dockerfile
3.2%
CSS
1.1%