|
@@ -803,6 +803,15 @@ namespace InABox.WPF
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ public static byte[] GetPDFThumbnail(byte[] pdfData, int width, int height)
|
|
|
+ {
|
|
|
+ PdfLoadedDocument loadeddoc = new PdfLoadedDocument(pdfData);
|
|
|
+ Bitmap image = loadeddoc.ExportAsImage(0, new SizeF(width, height), true);
|
|
|
+ MemoryStream stream = new MemoryStream();
|
|
|
+ image.Save(stream, ImageFormat.Jpeg);
|
|
|
+ return stream.ToArray();
|
|
|
+ }
|
|
|
+
|
|
|
public static List<byte[]> RenderPDFToImages(byte[] pdfData, ImageEncoding encoding = ImageEncoding.JPEG)
|
|
|
{
|
|
|
var rendered = new List<byte[]>();
|