/// <inheritdoc/> protected override void ExportPage(int pageNo) { FPagesCount++; if (FSinglePage) { HTMLThreadData d = new HTMLThreadData(); d.ReportPage = pageNo; d.PageNumber = FPagesCount; if (FNavigator) { GeneratedFiles.Add(FSinglePageFileName); using (d.PagesStream = new FileStream(FSinglePageFileName, FileMode.Append)) { ExportHTMLPage(d); } } else { if (FFormat == HTMLExportFormat.HTML) { d.PagesStream = Stream; } else { d.PagesStream = FMimeStream; } ExportHTMLPage(d); } } else if (!FWebMode) { ProcessPage(FPagesCount - 1, pageNo); } }
private System.Drawing.Image CreateMetafile(string suffix) { string extension = Path.GetExtension(FileName); string fileName = Path.ChangeExtension(FileName, suffix + extension); System.Drawing.Image image; using (Bitmap bmp = new Bitmap(1, 1)) using (Graphics g = Graphics.FromImage(bmp)) { IntPtr hdc = g.GetHdc(); if (suffix == "") { image = new Metafile(Stream, hdc); } else { image = new Metafile(fileName, hdc); if (!GeneratedFiles.Contains(fileName)) { GeneratedFiles.Add(fileName); } } g.ReleaseHdc(hdc); } return(image); }
/// <inheritdoc/> protected override void Finish() { if (!FSinglePage && !FWebMode && FThreaded) { while (!FFirstPageEvent.WaitOne(10, true)) { Application.DoEvents(); } } if (!FWebMode) { if (FNavigator) { if (FSinglePage) { using (Stream PageStream = new FileStream(FSinglePageFileName, FileMode.Append)) using (StreamWriter Out = new StreamWriter(PageStream)) { Out.WriteLine(BODY_END); Out.Write(FTemplates.PageTemplateFooter); } } ExportHTMLIndex(Stream); GeneratedFiles.Add(FTargetIndexPath + FNavFileName); using (FileStream OutStream = new FileStream(FTargetIndexPath + FNavFileName, FileMode.Create)) ExportHTMLNavigator(OutStream); GeneratedFiles.Add(FTargetIndexPath + FOutlineFileName); using (FileStream OutStream = new FileStream(FTargetIndexPath + FOutlineFileName, FileMode.Create)) ExportHTMLOutline(OutStream); } else if (FFormat == HTMLExportFormat.MessageHTML) { ExportUtils.WriteLn(FMimeStream, BODY_END); ExportUtils.Write(FMimeStream, FTemplates.PageTemplateFooter); WriteMHTHeader(); WriteMimePart(FMimeStream, "text/html", "utf-8", "index.html"); for (int i = 0; i < FPicsArchive.Count; i++) { string imagename = FPicsArchive[i].FileName; WriteMimePart(FPicsArchive[i].Stream, "image/" + imagename.Substring(imagename.LastIndexOf('.') + 1), "utf-8", imagename); } string last = "--" + FBoundary + "--"; Stream.Write(Encoding.ASCII.GetBytes(last), 0, last.Length); } else { ExportUtils.WriteLn(Stream, BODY_END); ExportUtils.Write(Stream, FTemplates.PageTemplateFooter); } } }
public StreamWriter OpenStream(string name) { if (!Directory.Exists(CSharpDir)) { Directory.CreateDirectory(CSharpDir); } string filename = Path.Combine(CSharpDir, name + ".cs"); var sw = new StreamWriter(File.Create(filename)); GeneratedFiles.Add(filename); return(sw); }
private void GeneratedUpdate(string filename, Stream stream) { int i = GeneratedFiles.IndexOf(filename); if (i == -1) { GeneratedFiles.Add(filename); generatedStreams.Add(stream); } else { generatedStreams[i] = stream; } }
private void DisposeBake(FileBakeContext fbc) { if (fbc != CurrentFile) { throw new Exception("Tried to dispose the wrong FileBakeContext"); } if (fbc == null) { throw new Exception("Dispose FileBakeContext should not be null"); } if (fbc.Export().Try(out var gf)) { GeneratedFiles.Add(gf); } OpenContexts.Pop(); }
private void ExportHTMLPageFinal(FastString CSS, FastString Page, HTMLData d, float MaxWidth, float MaxHeight) { if (!webMode) { if (!singlePage) { Page.AppendLine(BODY_END); } if (d.PagesStream == null) { string pageFileName = targetIndexPath + targetFileName + d.PageNumber.ToString() + ".html"; if (saveStreams) { string fileName = singlePage ? singlePageFileName : pageFileName; int i = GeneratedFiles.IndexOf(fileName); Stream outStream = (i == -1) ? new MemoryStream() : generatedStreams[i]; DoPage(outStream, documentTitle, CSS, Page); GeneratedUpdate(fileName, outStream); } else { GeneratedFiles.Add(pageFileName); using (FileStream outStream = new FileStream(pageFileName, FileMode.Create)) { DoPage(outStream, documentTitle, CSS, Page); } } } else { DoPage(d.PagesStream, documentTitle, CSS, Page); } } else { ExportHTMLPageFinalWeb(CSS, Page, d, MaxWidth, MaxHeight); } }
/// <inheritdoc/> protected override void Finish() { if (!webMode) { if (navigator) { if (saveStreams) { FinishSaveStreams(); } else { if (singlePage) { if (saveStreams) { int fileIndex = GeneratedFiles.IndexOf(singlePageFileName); DoPageEnd(generatedStreams[fileIndex]); } else { using (Stream pageStream = new FileStream(singlePageFileName, FileMode.Append)) { DoPageEnd(pageStream); } } } ExportHTMLIndex(Stream); GeneratedFiles.Add(targetIndexPath + navFileName); using (FileStream outStream = new FileStream(targetIndexPath + navFileName, FileMode.Create)) { ExportHTMLNavigator(outStream); } //GeneratedFiles.Add(FTargetIndexPath + FOutlineFileName); //using (FileStream OutStream = new FileStream(FTargetIndexPath + FOutlineFileName, FileMode.Create)) // ExportHTMLOutline(OutStream); } } else if (format == HTMLExportFormat.MessageHTML) { FinishMHT(); } else { if (saveStreams) { if (!String.IsNullOrEmpty(singlePageFileName)) { int fileIndex = GeneratedFiles.IndexOf(singlePageFileName); DoPageEnd(generatedStreams[fileIndex]); } } else { if (!singlePage) { DoPageStart(Stream, documentTitle, false); int pageCounter = 0; foreach (string genFile in GeneratedFiles) { string ext = Path.GetExtension(genFile); if (ext == ".html" && genFile != FileName) { string file = Path.GetFileName(genFile); if (subFolder) { file = Path.Combine(subFolderPath, file); } ExportUtils.WriteLn(Stream, String.Format("<a href=\"{0}\">Page {1}</a><br />", file, ++pageCounter)); } } } DoPageEnd(Stream); } } } }
/// <summary> /// Exports the report to a stream. /// </summary> /// <param name="report">Report to export.</param> /// <param name="stream">Stream to export to.</param> /// <remarks> /// This method does not show an export options dialog. If you want to show it, call <see cref="ShowDialog"/> /// method prior to calling this method, or use the "Export(Report report)" method instead. /// </remarks> public void Export(Report report, Stream stream) { SetReport(report); FStream = stream; PreparePageNumbers(); GeneratedFiles.Clear(); FExportTickCount = Environment.TickCount; if (FPages.Count > 0) { if (!String.IsNullOrEmpty(FileName)) { GeneratedFiles.Add(FileName); } Start(); report.SetOperation(ReportOperation.Exporting); if (ShowProgress) { Config.ReportSettings.OnStartProgress(Report); } try { for (int i = 0; i < FPages.Count; i++) { if (ShowProgress) { Config.ReportSettings.OnProgress(Report, String.Format(Res.Get("Messages,ExportingPage"), i + 1, FPages.Count), i + 1, FPages.Count); } if (!Report.Aborted && i < FPages.Count) { ExportPage(FPages[i]); } } } finally { Finish(); if (ShowProgress) { Config.ReportSettings.OnProgress(Report, String.Empty); } if (ShowProgress) { Config.ReportSettings.OnFinishProgress(Report); } report.SetOperation(ReportOperation.None); FExportTickCount = Environment.TickCount - FExportTickCount; if (Report.Preview != null && Config.ReportSettings.ShowPerformance) { Report.Preview.ShowPerformance(String.Format(Res.Get("Export,Misc,Performance"), FExportTickCount)); } if (FOpenAfter && AllowOpenAfter) { stream.Close(); OpenFile(); } } } }
private string HTMLGetImage(int PageNumber, int CurrentPage, int ImageNumber, string hash, bool Base, System.Drawing.Image Metafile, MemoryStream PictureStream, bool isSvg) { if (pictures) { System.Drawing.Imaging.ImageFormat format = System.Drawing.Imaging.ImageFormat.Bmp; if (imageFormat == ImageFormat.Png) { format = System.Drawing.Imaging.ImageFormat.Png; } else if (imageFormat == ImageFormat.Jpeg) { format = System.Drawing.Imaging.ImageFormat.Jpeg; } else if (imageFormat == ImageFormat.Gif) { format = System.Drawing.Imaging.ImageFormat.Gif; } string formatNm = isSvg ? "svg" : format.ToString().ToLower(); string embedImgType = isSvg ? "svg+xml" : format.ToString(); string embedPreffix = "data:image/" + embedImgType + ";base64,"; FastString ImageFileNameBuilder = new FastString(48); string ImageFileName; if (!saveStreams) { ImageFileNameBuilder.Append(Path.GetFileName(targetFileName)).Append("."); } ImageFileNameBuilder.Append(hash). Append(".").Append(formatNm); ImageFileName = ImageFileNameBuilder.ToString(); if (!webMode && !(preview || print)) { if (Base) { if (Metafile != null && !EmbedPictures) { if (saveStreams) { MemoryStream ImageFileStream = new MemoryStream(); Metafile.Save(ImageFileStream, format); GeneratedUpdate(targetPath + ImageFileName, ImageFileStream); } else { using (FileStream ImageFileStream = new FileStream(targetPath + ImageFileName, FileMode.Create)) Metafile.Save(ImageFileStream, format); } } else if (PictureStream != null && !EmbedPictures) { if (this.format == HTMLExportFormat.HTML) { string fileName = targetPath + ImageFileName; FileInfo info = new FileInfo(fileName); if (!(info.Exists && info.Length == PictureStream.Length)) { if (saveStreams) { GeneratedUpdate(targetPath + ImageFileName, PictureStream); } else { using (FileStream ImageFileStream = new FileStream(fileName, FileMode.Create)) PictureStream.WriteTo(ImageFileStream); } } } else { PicsArchiveItem item; item.FileName = ImageFileName; item.Stream = PictureStream; bool founded = false; for (int i = 0; i < picsArchive.Count; i++) { if (item.FileName == picsArchive[i].FileName) { founded = true; break; } } if (!founded) { picsArchive.Add(item); } } } if (!saveStreams) { GeneratedFiles.Add(targetPath + ImageFileName); } } if (EmbedPictures && PictureStream != null) { return(embedPreffix + GetBase64Image(PictureStream, hash)); } else if (subFolder && singlePage && !navigator) { return(ExportUtils.HtmlURL(subFolderPath + ImageFileName)); } else { return(ExportUtils.HtmlURL(ImageFileName)); } } else { if (EmbedPictures) { return(embedPreffix + GetBase64Image(PictureStream, hash)); } else { if (print || preview) { printPageData.Pictures.Add(PictureStream); printPageData.Guids.Add(hash); } else if (Base) { pages[CurrentPage].Pictures.Add(PictureStream); pages[CurrentPage].Guids.Add(hash); } return(webImagePrefix + "=" + hash + webImageSuffix); } } } else { return(String.Empty); } }
/// <inheritdoc/> protected override void Finish() { if (!webMode) { if (navigator) { if (saveStreams) { // do append in memory stream MemoryStream strm = new MemoryStream(); int i = GeneratedFiles.IndexOf(singlePageFileName); ExportHTMLIndex(generatedStreams[i]); MemoryStream OutStream = new MemoryStream(); ExportHTMLNavigator(OutStream); GeneratedUpdate(targetIndexPath + navFileName, OutStream); } else { if (singlePage) { if (saveStreams) { int i = GeneratedFiles.IndexOf(singlePageFileName); Stream PageStream = generatedStreams[i]; ExportUtils.WriteLn(PageStream, BODY_END); ExportUtils.Write(PageStream, templates.PageTemplateFooter); } else { using (Stream PageStream = new FileStream(singlePageFileName, FileMode.Append)) using (StreamWriter Out = new StreamWriter(PageStream)) { Out.WriteLine(BODY_END); Out.Write(templates.PageTemplateFooter); } } } ExportHTMLIndex(Stream); GeneratedFiles.Add(targetIndexPath + navFileName); using (FileStream OutStream = new FileStream(targetIndexPath + navFileName, FileMode.Create)) ExportHTMLNavigator(OutStream); //GeneratedFiles.Add(FTargetIndexPath + FOutlineFileName); //using (FileStream OutStream = new FileStream(FTargetIndexPath + FOutlineFileName, FileMode.Create)) // ExportHTMLOutline(OutStream); } } else if (format == HTMLExportFormat.MessageHTML) { ExportUtils.WriteLn(mimeStream, BODY_END); ExportUtils.Write(mimeStream, templates.PageTemplateFooter); WriteMHTHeader(Stream, FileName); WriteMimePart(mimeStream, "text/html", "utf-8", "index.html"); for (int i = 0; i < picsArchive.Count; i++) { string imagename = picsArchive[i].FileName; WriteMimePart(picsArchive[i].Stream, "image/" + imagename.Substring(imagename.LastIndexOf('.') + 1), "utf-8", imagename); } string last = "--" + boundary + "--"; Stream.Write(Encoding.ASCII.GetBytes(last), 0, last.Length); } else { if (saveStreams) { if (!String.IsNullOrEmpty(singlePageFileName)) { int i = GeneratedFiles.IndexOf(singlePageFileName); ExportUtils.WriteLn(generatedStreams[i], BODY_END); ExportUtils.Write(generatedStreams[i], templates.PageTemplateFooter); } } else { int pageCnt = 0; foreach (string genFile in GeneratedFiles) { string ext = Path.GetExtension(genFile); if (ext == ".html" && genFile != FileName) { string file = Path.GetFileName(genFile); if (subFolder) { file = Path.Combine(subFolderPath, file); } ExportUtils.WriteLn(Stream, String.Format("<a href=\"{0}\">Page {1}</a><br />", file, ++pageCnt)); } } //ExportUtils.WriteLn(Stream, BODY_END); //ExportUtils.Write(Stream, FTemplates.PageTemplateFooter); } } } }
private void ExportHTMLPageFinal(StringBuilder CSS, StringBuilder Page, HTMLThreadData d, float MaxWidth, float MaxHeight) { if (!FWebMode) { if (!FSinglePage) { Page.AppendLine(BODY_END); } if (d.PagesStream == null) { string FPageFileName = FTargetIndexPath + FTargetFileName + d.PageNumber.ToString() + ".html"; GeneratedFiles.Add(FPageFileName); using (FileStream OutStream = new FileStream(FPageFileName, FileMode.Create)) using (StreamWriter Out = new StreamWriter(OutStream)) { if (!FSinglePage) { Out.Write(String.Format(FTemplates.PageTemplateTitle, FDocumentTitle)); } if (CSS != null) { Out.Write(CSS.ToString()); } if (Page != null) { Out.Write(Page.ToString()); } if (!FSinglePage) { Out.Write(FTemplates.PageTemplateFooter); } } } else { if (!FSinglePage) { ExportUtils.Write(d.PagesStream, String.Format(FTemplates.PageTemplateTitle, FDocumentTitle)); } if (CSS != null) { ExportUtils.Write(d.PagesStream, CSS.ToString()); } if (Page != null) { ExportUtils.Write(d.PagesStream, Page.ToString()); } if (!FSinglePage) { ExportUtils.Write(d.PagesStream, FTemplates.PageTemplateFooter); } } } else { FPages[d.CurrentPage].Width = MaxWidth / Zoom; FPages[d.CurrentPage].Height = MaxHeight / Zoom; FPages[d.CurrentPage].PageText = Page.ToString(); FPages[d.CurrentPage].PageEvent.Set(); } if (!FSinglePage && FThreaded) { if (d.PageNumber == 1) { FFirstPageEvent.Set(); } } }
private string HTMLGetImage(int PageNumber, int CurrentPage, int ImageNumber, string hash, bool Base, System.Drawing.Image Metafile, MemoryStream PictureStream) { if (FPictures) { System.Drawing.Imaging.ImageFormat format = System.Drawing.Imaging.ImageFormat.Bmp; if (FImageFormat == ImageFormat.Png) { format = System.Drawing.Imaging.ImageFormat.Png; } else if (FImageFormat == ImageFormat.Jpeg) { format = System.Drawing.Imaging.ImageFormat.Jpeg; } else if (FImageFormat == ImageFormat.Gif) { format = System.Drawing.Imaging.ImageFormat.Gif; } StringBuilder ImageFileNameBuilder = new StringBuilder(48); string ImageFileName = ImageFileNameBuilder.Append(Path.GetFileName(FTargetFileName)). Append(".").Append(hash). Append(".").Append(format.ToString().ToLower()).ToString(); if (!FWebMode) { if (Base) { if (Metafile != null) { using (FileStream ImageFileStream = new FileStream(FTargetPath + ImageFileName, FileMode.Create)) Metafile.Save(ImageFileStream, format); } else if (PictureStream != null) { if (FFormat == HTMLExportFormat.HTML) { string fileName = FTargetPath + ImageFileName; FileInfo info = new FileInfo(fileName); if (!(info.Exists && info.Length == PictureStream.Length)) { using (FileStream ImageFileStream = new FileStream(fileName, FileMode.Create)) PictureStream.WriteTo(ImageFileStream); } } else { PicsArchiveItem item; item.FileName = ImageFileName; item.Stream = PictureStream; bool founded = false; for (int i = 0; i < FPicsArchive.Count; i++) { if (item.FileName == FPicsArchive[i].FileName) { founded = true; break; } } if (!founded) { FPicsArchive.Add(item); } } } GeneratedFiles.Add(FTargetPath + ImageFileName); } if (FSubFolder && FSinglePage && !FNavigator) { return(ExportUtils.HtmlURL(FSubFolderPath + ImageFileName)); } else { return(ExportUtils.HtmlURL(ImageFileName)); } } else { if (Base) { FPages[CurrentPage].Pictures.Add(PictureStream); FPages[CurrentPage].Guids.Add(hash); } return(FWebImagePrefix + "=" + hash); } } else { return(String.Empty); } }
public async Task Initialize(SwaggerReference info) { var swaggerDocumentLoader = new SwaggarDocumentLoader(_yamlSerializers, _httpClientFactory); var swaggerDocuments = new List <SwaggerDocument>(); var httpClient = _httpClientFactory.Create(null); foreach (var input in info.inputs) { if (string.IsNullOrEmpty(info.source)) { // TODO : re-abstract this case into docmgr using (var yamlReader = InnerPackage.OpenText(input)) { var swaggerDocument = _yamlSerializers.YamlDeserializer.Deserialize <SwaggerDocument>(yamlReader); swaggerDocuments.Add(swaggerDocument); } } else { var uriParts = UriParts.Parse(info.source); uriParts.RewriteGitHubUris(); var swaggerDocument = await swaggerDocumentLoader.LoadDocument(uriParts.ToString(), input); swaggerDocuments.Add(swaggerDocument); } } foreach (var swaggerDocument in swaggerDocuments) { foreach (var pathEntry in swaggerDocument.paths) { foreach (var operationEntry in pathEntry.Value.operations) { var context = new GenerateSingleRequestDefinitionContext { SwaggerReference = info, SwaggerDocument = swaggerDocument, SwaggarDocumentLoader = swaggerDocumentLoader, Path = pathEntry, Operation = operationEntry, }; _requestGenerator.GenerateSingleRequestDefinition(context); if (GeneratedFiles.ContainsKey(context.GeneratedPath)) { for (var index = 2; index != 200; ++index) { if (!GeneratedFiles.ContainsKey($"{context.GeneratedPath}.{index}")) { GeneratedFiles.Add( $"{context.GeneratedPath}.{index}", context.GeneratedContent); break; } } } else { GeneratedFiles.Add( context.GeneratedPath, context.GeneratedContent); } } } } }
private void SaveImage(System.Drawing.Image image, string suffix) { // store the resolution in output file. // Call this method after actual draw because it may affect drawing the text if (image is Bitmap) { (image as Bitmap).SetResolution(ResolutionX, ResolutionY); } if (IsMultiFrameTiff) { // select the image encoder ImageCodecInfo info = ExportUtils.GetCodec("image/tiff"); EncoderParameters ep = new EncoderParameters(2); ep.Param[0] = new EncoderParameter(Encoder.Compression, MonochromeTiff ? (long)MonochromeTiffCompression : (long)EncoderValue.CompressionLZW); if (image == masterTiffImage) { // save the master bitmap if (MonochromeTiff) { masterTiffImage = ConvertToBitonal(image as Bitmap); } ep.Param[1] = new EncoderParameter(Encoder.SaveFlag, (long)EncoderValue.MultiFrame); masterTiffImage.Save(Stream, info, ep); } else { // save the frame if (MonochromeTiff) { System.Drawing.Image oldImage = image; image = ConvertToBitonal(image as Bitmap); oldImage.Dispose(); } ep.Param[1] = new EncoderParameter(Encoder.SaveFlag, (long)EncoderValue.FrameDimensionPage); masterTiffImage.SaveAdd(image, ep); } } else if (ImageFormat != ImageExportFormat.Metafile) { string extension = Path.GetExtension(FileName); string fileName = Path.ChangeExtension(FileName, suffix + extension); // empty suffix means that we should use the Stream that was created in the ExportBase Stream stream = suffix == "" ? Stream : new FileStream(fileName, FileMode.Create); if (suffix != "") { GeneratedFiles.Add(fileName); } if (ImageFormat == ImageExportFormat.Jpeg) { ExportUtils.SaveJpeg(image, stream, JpegQuality); } else if (ImageFormat == ImageExportFormat.Tiff && MonochromeTiff) { // handle monochrome tiff separately ImageCodecInfo info = ExportUtils.GetCodec("image/tiff"); EncoderParameters ep = new EncoderParameters(); ep.Param[0] = new EncoderParameter(Encoder.Compression, (long)MonochromeTiffCompression); using (Bitmap bwImage = ConvertToBitonal(image as Bitmap)) { bwImage.Save(stream, info, ep); } } else { ImageFormat format = System.Drawing.Imaging.ImageFormat.Bmp; switch (ImageFormat) { case ImageExportFormat.Gif: format = System.Drawing.Imaging.ImageFormat.Gif; break; case ImageExportFormat.Png: format = System.Drawing.Imaging.ImageFormat.Png; break; case ImageExportFormat.Tiff: format = System.Drawing.Imaging.ImageFormat.Tiff; break; } image.Save(stream, format); } if (suffix != "") { stream.Dispose(); } } if (image != masterTiffImage) { image.Dispose(); } }
/// <summary> /// Exports the report to a stream. /// </summary> /// <param name="report">Report to export.</param> /// <param name="stream">Stream to export to.</param> /// <remarks> /// This method does not show an export options dialog. If you want to show it, call <see cref="ShowDialog"/> /// method prior to calling this method, or use the "Export(Report report)" method instead. /// </remarks> public void Export(Report report, Stream stream) { SetReport(report); this.stream = stream; PreparePageNumbers(); GeneratedFiles.Clear(); exportTickCount = Environment.TickCount; if (pages.Count > 0) { if (!String.IsNullOrEmpty(FileName)) { GeneratedFiles.Add(FileName); } Start(); report.SetOperation(ReportOperation.Exporting); if (ShowProgress) { Config.ReportSettings.OnStartProgress(Report); } else { Report.SetAborted(false); } try { for (int i = 0; i < GetPagesCount(pages); i++) { if (ShowProgress) { Config.ReportSettings.OnProgress(Report, String.Format(Res.Get("Messages,ExportingPage"), i + 1, pages.Count), i + 1, pages.Count); } if (!Report.Aborted && i < pages.Count) { ExportPageNew(pages[i]); } else { break; } } } finally { Finish(); if (ShowProgress) { Config.ReportSettings.OnProgress(Report, String.Empty); } if (ShowProgress) { Config.ReportSettings.OnFinishProgress(Report); } report.SetOperation(ReportOperation.None); exportTickCount = Environment.TickCount - exportTickCount; ShowPerformance(exportTickCount); if (openAfter && AllowOpenAfter && stream != null) { stream.Close(); OpenFile(); } } } }
private void ExportHTMLPageFinal(FastString CSS, FastString Page, HTMLThreadData d, float MaxWidth, float MaxHeight) { if (!webMode) { if (!singlePage) { Page.AppendLine(BODY_END); } if (d.PagesStream == null) { if (saveStreams) { string FPageFileName; if (singlePage) { FPageFileName = singlePageFileName; } else { FPageFileName = targetIndexPath + targetFileName + d.PageNumber.ToString() + ".html"; } int i = GeneratedFiles.IndexOf(FPageFileName); Stream OutStream; if (i == -1) { OutStream = new MemoryStream(); } else { OutStream = generatedStreams[i]; } if (!singlePage) { ExportUtils.Write(OutStream, String.Format(templates.PageTemplateTitle, documentTitle)); } if (CSS != null) { ExportUtils.Write(OutStream, CSS.ToString()); CSS.Clear(); } if (Page != null) { ExportUtils.Write(OutStream, Page.ToString()); Page.Clear(); } if (!singlePage) { ExportUtils.Write(OutStream, templates.PageTemplateFooter); } GeneratedUpdate(FPageFileName, OutStream); } else { string FPageFileName = targetIndexPath + targetFileName + d.PageNumber.ToString() + ".html"; GeneratedFiles.Add(FPageFileName); using (FileStream OutStream = new FileStream(FPageFileName, FileMode.Create)) using (StreamWriter Out = new StreamWriter(OutStream)) { if (!singlePage) { Out.Write(String.Format(templates.PageTemplateTitle, documentTitle)); } if (CSS != null) { Out.Write(CSS.ToString()); CSS.Clear(); } if (Page != null) { Out.Write(Page.ToString()); Page.Clear(); } if (!singlePage) { Out.Write(templates.PageTemplateFooter); } } } } else { if (!singlePage) { ExportUtils.Write(d.PagesStream, String.Format(templates.PageTemplateTitle, documentTitle)); } if (CSS != null) { ExportUtils.Write(d.PagesStream, CSS.ToString()); CSS.Clear(); } if (Page != null) { ExportUtils.Write(d.PagesStream, Page.ToString()); Page.Clear(); } if (!singlePage) { ExportUtils.Write(d.PagesStream, templates.PageTemplateFooter); } } } else { if (!layers) { pages[d.CurrentPage].Width = MaxWidth / Zoom; pages[d.CurrentPage].Height = MaxHeight / Zoom; } else { pages[d.CurrentPage].Width = MaxWidth; pages[d.CurrentPage].Height = MaxHeight; } if (Page != null) { pages[d.CurrentPage].PageText = Page.ToString(); Page.Clear(); } if (CSS != null) { pages[d.CurrentPage].CSSText = CSS.ToString(); CSS.Clear(); } pages[d.CurrentPage].PageEvent.Set(); } }