Image = imageToConvert = null; for (int i = 0; i < images.Length; i++) { if (i == 0) { //Save converted image if PDF is single page imageToConvert = images[i]; SaveFileDialog _saveFile = new SaveFileDialog(); _saveFile.Title = "Save file"; _saveFile.Filter = "PNG|*.png"; _saveFile.FileName = Lbl_OriginalFileName.Text; if (_saveFile.ShowDialog() == DialogResult.OK) { imageToConvert.Save(_saveFile.FileName, ImageFormat.Png); imageToConvert.Dispose(); } else if (_saveFile.ShowDialog() == DialogResult.Cancel) { return; } } else { if (i > 0) { // Save converted Images if PDF is multi-page Image imageToConvert2 = images[i]; FolderBrowserDialog fbd = new FolderBrowserDialog(); fbd.ShowDialog(); fbd.Description = "Select the folder you want save your files into."; string pathString = Path.Combine(fbd.SelectedPath, subFolder); Directory.CreateDirectory(pathString); if (fbd.ShowDialog() == DialogResult.Cancel) { return; } string saveFileNamesPNG = string.Format(Lbl_OriginalFileName.Text + "_" + i.ToString() + ".png", ImageFormat.Png); imageToConvert.Save(Path.Combine(pathString, saveFileNamesPNG)); imageToConvert.Dispose(); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)