private void Add(DxfDocument dxf, Core2D.Project.XDocument document) { foreach (var page in document.Pages) { var layout = new Layout(page.Name) { PlotSettings = new PlotSettings() { PaperSizeName = $"{page.Template.Name}_({page.Template.Width}_x_{page.Template.Height}_MM)", LeftMargin = 0.0, BottomMargin = 0.0, RightMargin = 0.0, TopMargin = 0.0, PaperSize = new Vector2(page.Template.Width, page.Template.Height), Origin = new Vector2(0.0, 0.0), PaperUnits = PlotPaperUnits.Milimeters, PaperRotation = PlotRotation.NoRotation } }; dxf.Layouts.Add(layout); dxf.ActiveLayout = layout.Name; Add(dxf, page); } }
/// <inheritdoc/> void Core2D.Interfaces.IProjectExporter.Save(string path, Core2D.Project.XDocument document) { using (var pdf = new PdfDocument()) { var documentOutline = default(PdfOutline); foreach (var container in document.Pages) { var page = Add(pdf, container); if (documentOutline == null) { documentOutline = pdf.Outlines.Add( document.Name, page, true, PdfOutlineStyle.Regular, XColors.Black); } documentOutline.Outlines.Add( container.Name, page, true, PdfOutlineStyle.Regular, XColors.Black); } pdf.Save(path); ClearCache(isZooming: false); } }
/// <inheritdoc/> void Core2D.Interfaces.IProjectExporter.Save(string path, Core2D.Project.XDocument document) { _outputPath = System.IO.Path.GetDirectoryName(path); var dxf = new DxfDocument(DxfVersion.AutoCad2010); Add(dxf, document); dxf.Save(path); ClearCache(isZooming: false); }