개정판 6547b5f1
issue #000:
- fixed some bugs
DTI_PID/PDF_TO_IMAGE/ConvertImage.cs | ||
---|---|---|
26 | 26 | |
27 | 27 |
private void Btn_LoadPDF_Click(object sender, EventArgs e) |
28 | 28 |
{ |
29 |
OpenFileDialog OFD = new OpenFileDialog(); |
|
30 |
OFD.Filter = "PDF Files (.PDF)|*.PDF"; |
|
29 |
OpenFileDialog OFD = new OpenFileDialog() { Filter = "PDF Files (.PDF)|*.PDF" }; |
|
31 | 30 |
if (OFD.ShowDialog() == DialogResult.OK) |
32 | 31 |
{ |
33 | 32 |
string pdfpath = OFD.FileName; |
... | ... | |
129 | 128 | |
130 | 129 |
private void Btn_Convert_Click(object sender, EventArgs e) |
131 | 130 |
{ |
132 | ||
133 | 131 |
int iDpi = 0; |
134 | 132 |
if(Txt_PDFPath.Text != "" && int.TryParse(Combo_DPI.Text,out iDpi) == true) |
135 | 133 |
{ |
... | ... | |
145 | 143 |
pdftron.PDFNet.Initialize("daelim.co.kr(Doftech Corp):CPU:2::W:AMC(20120315):EF6E886F25A414FFB5F8C1F2999CF2DA33DC6C5164315BAF7011B87AF0FA"); |
146 | 144 |
using (PDFDoc doc = new PDFDoc(Txt_PDFPath.Text)) |
147 | 145 |
{ |
148 | ||
149 | 146 |
ImageCodecInfo DefaultImageCodecInfo = GetEncoderInfo("image/png"); |
150 | 147 |
EncoderParameters DefaultEncoderParameters = new EncoderParameters(2); |
151 | 148 |
System.Drawing.Imaging.Encoder QualityEncoder = System.Drawing.Imaging.Encoder.Quality; |
... | ... | |
192 | 189 |
|
193 | 190 |
var rotation = doc.GetPage(i).GetRotation(); |
194 | 191 |
draw.SetImageSize(widthData, heightData, true); |
195 |
sFileName = pagePath + "_" + widthData + "_" + heightData + ".jpeg";
|
|
192 |
sFileName = pagePath + "_" + widthData + "_" + heightData + ".png";
|
|
196 | 193 |
} |
197 | 194 |
draw.SetAntiAliasing(false); |
198 | 195 |
draw.SetImageSmoothing(false); |
... | ... | |
206 | 203 |
using (Bitmap bmpImage = new Bitmap(_savestream)) |
207 | 204 |
{ |
208 | 205 |
ObjSet objset = new ObjSet(); |
209 |
Obj jbig2_hint = objset.CreateName("jpeg");
|
|
210 |
bmpImage.Save(sFileName); |
|
206 |
Obj jbig2_hint = objset.CreateName("png");
|
|
207 |
bmpImage.Save(sFileName, ImageFormat.Png);
|
|
211 | 208 |
bmpImage.Dispose(); |
212 | 209 |
// Do something with the Bitmap object |
213 | 210 |
} |
214 |
// newBmp_ = new Bitmap(_savestream); |
|
215 |
|
|
216 | 211 |
} |
217 | 212 |
catch (Exception ex) |
218 | 213 |
{ |
... | ... | |
236 | 231 |
} |
237 | 232 |
#endregion |
238 | 233 |
} |
239 | ||
240 | ||
241 | 234 |
} |
242 | 235 |
else |
243 | 236 |
{ |
내보내기 Unified diff