/////////////////////////////////////////////////////////////////////////////////////////////////// //private void exportImages(IExportDocument docRef, IExportTools exportTools, string exportFolder, ref Sections SectionsContainer) private void exportImages(ref IExportDocument docRef, ref IExportImageSavingOptions imageOptions, string exportFolder, ref Sections SectionsContainer) { /*IExportImageSavingOptions imageOptions = exportTools.NewImageSavingOptions(); * imageOptions.Format = "pdf"; * imageOptions.ColorType = "FullColor"; * imageOptions.Resolution = 300;*/ //StreamWriter sw = File.CreateText(@"C:\MyExport\pages.txt"); int k; /*try * {*/ for (int i = 0; i < SectionsContainer.Count; i++) { //sw.WriteLine(SectionsContainer[i].FileName + " : " + SectionsContainer[i].StartInd); //sw.WriteLine(i); //sw.Flush(); foreach (IExportPage curPage in docRef.Pages) { curPage.ExcludedFromDocumentImage = true; } if (i == SectionsContainer.Count - 1) { k = docRef.Pages.Count; } else { k = SectionsContainer[i + 1].StartInd; } for (int j = SectionsContainer[i].StartInd; j < k; j++) { docRef.Pages[j].ExcludedFromDocumentImage = false; } docRef.SaveAs(exportFolder + "\\" + SectionsContainer[i].FileName + ".pdf", imageOptions); } /*} * //finally * //{ * // sw.Close(); * }*/ }
public void ExportDocument(ref IExportDocument docRef, ref IExportTools exportTools, ref IExportImageSavingOptions imageOptions, ref string ExportFolder) { try { //string exportFolder = @"C:\MyExport"; int val = 0; Guid guid = Guid.NewGuid(); Sections SectionsContainer = new Sections(); exportSections(docRef.Children, ExportFolder, guid, ref val, ref SectionsContainer); exportImages(ref docRef, ref imageOptions, ExportFolder, ref SectionsContainer); } catch (Exception e) { docRef.Action.Succeeded = false; docRef.Action.ErrorMessage = e.ToString(); } }