Example #1
0
        //--------------------------------------------------------------------------------------------------

        void IDrawingRenderer.EndPath()
        {
            if (_ContentBuilder.HasContent)
            {
                _ContentBuilder.EndPath();
                _Content.Add(_ContentBuilder.Finish());
            }
            _ContentBuilder = new PdfContentBuilder();
        }
Example #2
0
        //--------------------------------------------------------------------------------------------------

        MemoryStream _Export(Drawing drawing)
        {
            _Document       = new PdfDomDocument();
            _Page           = _Document.AddPage();
            _Content        = _Page.AddContent();
            _ContentBuilder = new PdfContentBuilder();

            var aabb = drawing.GetBoundingBox();

            if (!aabb.IsVoid())
            {
                double xmin = 0, xmax = 0, ymin = 0, ymax = 0;
                aabb.Get(ref xmin, ref ymin, ref xmax, ref ymax);
                _Page.MediaBox = new[] { xmin, ymin, xmax, ymax };
            }

            // Export
            drawing.Render(this);

            var stream = _Document.WriteToStream();

            _Document = null;
            return(stream);
        }