개정판 76f465d0
Line을먼저그리고 symbol을 그리는 형태로 변경
DTI_PID/PDF_TO_IMAGE/ConvertImage.cs | ||
---|---|---|
151 | 151 |
System.Drawing.Imaging.Encoder QualityEncoder = System.Drawing.Imaging.Encoder.Quality; |
152 | 152 |
System.Drawing.Imaging.Encoder ColorDepthEncoder = System.Drawing.Imaging.Encoder.ColorDepth; |
153 | 153 |
DefaultEncoderParameters.Param[0] = new EncoderParameter(QualityEncoder, 100L); |
154 |
DefaultEncoderParameters.Param[1] = new EncoderParameter(ColorDepthEncoder, 8L);
|
|
154 |
DefaultEncoderParameters.Param[1] = new EncoderParameter(ColorDepthEncoder, 1L);
|
|
155 | 155 |
|
156 | 156 |
#region 이미지 만들기 |
157 | 157 |
for (int i = 1; i < doc.GetPageCount() + 1; i++) |
158 | 158 |
{ |
159 |
string sFileName = ""; |
|
160 |
string pagePath = sPathNonExtension; |
|
161 |
if (i > 1) |
|
162 |
{ |
|
163 |
pagePath = sPathNonExtension + "_" + i; |
|
164 |
} |
|
159 | 165 |
try |
160 | 166 |
{ |
161 | 167 |
using (pdftron.PDF.PDFDraw draw = new pdftron.PDF.PDFDraw()) |
162 | 168 |
{ |
163 |
float fDpix = 600; |
|
164 |
float fDpiy = 600; |
|
165 |
try |
|
166 |
{ |
|
167 |
fDpix = float.Parse(Combo_DPI.Text); |
|
168 |
fDpiy = float.Parse(Combo_DPI.Text); |
|
169 |
} |
|
170 |
catch |
|
171 |
{ } |
|
172 | 169 |
ElementBuilder bld = new ElementBuilder(); |
173 | 170 |
ElementWriter writer = new ElementWriter(); |
174 |
var rotation = doc.GetPage(i).GetRotation(); |
|
171 |
if (Chk_DPI.Checked) |
|
172 |
{ |
|
173 |
float fDpix = 600; |
|
174 |
float fDpiy = 600; |
|
175 |
try |
|
176 |
{ |
|
177 |
fDpix = float.Parse(Combo_DPI.Text); |
|
178 |
fDpiy = float.Parse(Combo_DPI.Text); |
|
179 |
} |
|
180 |
catch |
|
181 |
{ } |
|
182 |
|
|
183 |
var rotation = doc.GetPage(i).GetRotation(); |
|
184 |
|
|
185 |
draw.SetDPI(fDpix); |
|
186 |
sFileName = pagePath + "_" + fDpix + ".jpeg"; |
|
187 |
} |
|
188 |
else |
|
189 |
{ |
|
190 |
|
|
191 |
|
|
192 |
var widthData =int.Parse( Txt_Width.Text); |
|
193 |
int heightData = int.Parse(Txt_Height.Text); |
|
194 |
|
|
195 |
var rotation = doc.GetPage(i).GetRotation(); |
|
196 |
draw.SetImageSize(widthData, heightData, true); |
|
197 |
sFileName = pagePath + "_" + widthData + "_" + heightData + ".jpeg"; |
|
198 |
} |
|
175 | 199 |
draw.SetAntiAliasing(false); |
176 |
draw.SetDPI(fDpix);
|
|
200 |
draw.SetImageSmoothing(false);
|
|
177 | 201 |
Bitmap newBmp_ = draw.GetBitmap(doc.GetPage(i)); |
178 | 202 |
|
179 | 203 |
using (MemoryStream _savestream = new MemoryStream()) |
... | ... | |
181 | 205 |
try |
182 | 206 |
{ |
183 | 207 |
newBmp_.Save(_savestream, DefaultImageCodecInfo, DefaultEncoderParameters); |
184 |
newBmp_ = new Bitmap(_savestream); |
|
185 |
ObjSet objset = new ObjSet(); |
|
186 |
Obj jbig2_hint = objset.CreateName("png"); |
|
187 |
string pagePath = sPathNonExtension; |
|
188 |
if (i > 1) |
|
208 |
using (Bitmap bmpImage = new Bitmap(_savestream)) |
|
189 | 209 |
{ |
190 |
pagePath = sPathNonExtension + "_" + i; |
|
210 |
ObjSet objset = new ObjSet(); |
|
211 |
Obj jbig2_hint = objset.CreateName("jpeg"); |
|
212 |
bmpImage.Save(sFileName); |
|
213 |
bmpImage.Dispose(); |
|
214 |
// Do something with the Bitmap object |
|
191 | 215 |
} |
192 |
newBmp_.Save(pagePath + "_" + fDpix + ".png");
|
|
193 |
newBmp_.Dispose(); |
|
216 |
// newBmp_ = new Bitmap(_savestream);
|
|
217 |
|
|
194 | 218 |
} |
195 | 219 |
catch (Exception ex) |
196 | 220 |
{ |
내보내기 Unified diff