-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathPdfPageModel.cs
38 lines (33 loc) · 993 Bytes
/
PdfPageModel.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Drawing;
using System.IO;
using DevExpress.Pdf;
using System.Drawing.Imaging;
namespace E5101.Models {
public class PdfPageModel {
PdfDocumentProcessor _documentProcessor;
public PdfPageModel(PdfDocumentProcessor documentProcessor) {
this._documentProcessor = documentProcessor;
}
public PdfDocumentProcessor DocumentProcessor {
get {
return _documentProcessor;
}
}
public int PageNumber {
get;
set;
}
public byte[] GetPageImageBytes() {
using (Bitmap bitmap = DocumentProcessor.CreateBitmap(PageNumber, 900)) {
using (MemoryStream stream = new MemoryStream()) {
bitmap.Save(stream, ImageFormat.Png);
return stream.ToArray();
}
}
}
}
}