ImageSavingArgs Class |
Namespace: Aspose.Tasks
The ImageSavingArgs type exposes the following members.
Name | Description | |
---|---|---|
![]() ![]() | ImageSavingArgs |
Initializes a new instance of the ImageSavingArgs class.
|
Name | Description | |
---|---|---|
![]() ![]() | FileName |
Gets or sets the supposed file name that goes from converter to code of custom method.
Can be use in custom code to decide how to process or where save that file.
(Inherited from ResourceSavingArgs.) |
![]() ![]() | ImageType |
Gets a HTML image type.
|
![]() ![]() | KeepStreamOpen |
Gets or sets a value indicating whether the stream will be kept open after resource saving finishes.
(Inherited from ResourceSavingArgs.) |
![]() ![]() | Stream |
Gets or sets the binary content of saved file.
(Inherited from ResourceSavingArgs.) |
![]() ![]() | Uri |
Gets or sets the resource URI.
(Inherited from ResourceSavingArgs.) |
Name | Description | |
---|---|---|
![]() ![]() | CloseStreamIfRequired |
Close stream if KeepStreamOpen is false, else flush it.
(Inherited from ResourceSavingArgs.) |
![]() | Equals | (Inherited from Object.) |
![]() | Finalize | (Inherited from Object.) |
![]() | GetHashCode | (Inherited from Object.) |
![]() | GetType | (Inherited from Object.) |
![]() | MemberwiseClone | (Inherited from Object.) |
![]() | ToString | (Inherited from Object.) |
public void ResourcePrefixForNestedResourcesExample() { var project = new Project(DataDir + "Project1.mpp"); var options = ResourcePrefixForNestedResources.GetSaveOptions(1); project.Save(OutDir + "document_out.html", options); } private class ResourcePrefixForNestedResources : ICssSavingCallback, IFontSavingCallback, IImageSavingCallback { public void CssSaving(CssSavingArgs args) { if (!Directory.Exists(OutDir + "css/")) { Directory.CreateDirectory(OutDir + "css/"); } var stream = new FileStream(OutDir + "css/" + args.FileName, FileMode.Create); args.Stream = stream; args.KeepStreamOpen = false; args.Uri = OutDir + "css/" + args.FileName; } public void FontSaving(FontSavingArgs args) { if (!Directory.Exists(OutDir + "fonts/")) { Directory.CreateDirectory(OutDir + "fonts/"); } var stream = new FileStream(OutDir + "fonts/" + args.FileName, FileMode.Create); args.Stream = stream; args.KeepStreamOpen = false; args.Uri = OutDir + "fonts/" + args.FileName; } public void ImageSaving(ImageSavingArgs args) { if (!Directory.Exists(OutDir + "resources/")) { Directory.CreateDirectory(OutDir + "resources/"); } if (!Directory.Exists(OutDir + "resources/nestedResources/")) { Directory.CreateDirectory(OutDir + "resources/nestedResources/"); } if (args.FileName.EndsWith("png")) { var stream1 = new FileStream(OutDir + "resources/nestedResources/" + args.FileName, FileMode.Create); args.Stream = stream1; args.KeepStreamOpen = false; args.Uri = OutDir + "resources/" + args.FileName; // args.NestedUri = dataDir + "nestedResources/" + args.FileName; } else { var stream2 = new FileStream(OutDir + "resources/" + args.FileName, FileMode.Create); args.Stream = stream2; args.KeepStreamOpen = false; args.Uri = OutDir + "resources/" + args.FileName; } } public static HtmlSaveOptions GetSaveOptions(int pageNumber) { var options = new HtmlSaveOptions { Pages = new List<int>(), IncludeProjectNameInPageHeader = false, IncludeProjectNameInTitle = false, PageSize = PageSize.A3, Timescale = Timescale.ThirdsOfMonths, ReduceFooterGap = true, FontFaceTypes = FontFaceType.Ttf, ExportCss = ResourceExportType.AsFile, ExportFonts = ResourceExportType.AsFile, ExportImages = ResourceExportType.AsFile }; var program = new ResourcePrefixForNestedResources(); options.FontSavingCallback = program; options.CssSavingCallback = program; options.ImageSavingCallback = program; options.Pages.Clear(); options.Pages.Add(pageNumber); if (!Directory.Exists(DataDir + "fonts")) { Directory.CreateDirectory(DataDir + "fonts"); } if (!Directory.Exists(DataDir + "resources")) { Directory.CreateDirectory(DataDir + "resources"); } if (!Directory.Exists(DataDir + "nestedResources")) { Directory.CreateDirectory(DataDir + "resources/nestedResources"); } if (!Directory.Exists(DataDir + "css")) { Directory.CreateDirectory(DataDir + "css"); } return options; } }