RhinoPageView to image help

I use the below codes to plot RhinoPageView to image, it works fine for RhinoView, transparent back groud, however, for RhinoPageView, the background was not transparent, and the border of the viewport was displayed(like the below image), any ideas how to fix it? if go to print menu, print to PDF, the backgroud is transparent, and the border of the viewport was not shown, Thanks a lot!

        foreach (var view in doc.Views)
        {
            var path = string.Format(filePath, view.MainViewport.Name);
            Bitmap bmp = null;
            ViewCapture viewCapture = new ViewCapture()
            {
                ScaleScreenItems = false,
                DrawAxes = false,
                DrawGrid = false,
                DrawGridAxes = false,
                TransparentBackground = true
            };

            if (view is RhinoView)
            {
                viewCapture.Width = view.ActiveViewport.Size.Width;
                viewCapture.Height = view.ActiveViewport.Size.Height;
                bmp = viewCapture.CaptureToBitmap(view);
            }
            else if (view is RhinoPageView)
            {
                var detailView = view as RhinoPageView;
                var detailViews = detailView.GetDetailViews();
                viewCapture.Width = (int) detailView.PageWidth;
                viewCapture.Height = (int)detailView.PageHeight;
                bmp = viewCapture.CaptureToBitmap(view);
            }

            bmp.Save(path);
        }

RhinoPageViews have their own constructor method in ViewCapture.

bmp = viewCapture.CaptureToBitmap(detailView, resolution);

DrawBackground is another property to observe as well.

1 Like

Got it, let me try that, Thanks Travis!

That works, Thanks Travis!

1 Like