A .NET library to render PDF files into images.
This .NET library is built on top of
Call a static method from PDFtoImage.Conversion
:
SaveJpeg
, SavePng
, SaveWebp
and ToImage
for a single page.
ToImages
and ToImagesAsync
for multiple pages.
Note: SkiaSharp.SKBitmap
can be exported with the Encode
method.
- Open your project and navigate to
Window
→Package Manager
. - Click on the
+
button (top-left corner) and selectAdd package from git URL...
. - Enter the following URL and confirm with the
Add
button:
https://github.com/sungaila/PDFtoImage.git?path=etc/UnityPackage
Starting with v4.0.0 the struct RenderOptions
is used for most methods. This is a breaking change when updating from v3.1.0 and older.
// this will not compile anymore
PDFtoImage.Conversion.SaveJpeg("image.jpg", pdfStream, dpi: 300, rotation: PdfRotation.Rotate90);
// use this instead
PDFtoImage.Conversion.SaveJpeg("image.jpg", pdfStream, options: new(Dpi: 300, Rotation: PdfRotation.Rotate90));
Note: This namespace is used for backward compatibility and will be removed in a future version.
using PDFtoImage;
using Conversion = PDFtoImage.Compatibility.Conversion;