Rhinocommon Save image of layout pageview instead of PDF

Is there a way to save out an image ( jpg, png, whatever ) from a layout pageview? I can save out the pageview to a PDF, but I need to get an image as well.

I know that I can use layout.PageView.CaptureToBitmap , but this doesn’t capture the same print area and it has the bad background color of the layout view.

Here is how I save out the pdf from my layout. Is there a way to save out an image in a similar way?

        var sheetPdf = Rhino.FileIO.FilePdf.Create();
        var size = partParams.layout.PageView.Size;
        var sheetCapture = new Rhino.Display.ViewCaptureSettings(partParams.layout.PageView, 300);
        sheetPdf.AddPage(sheetCapture);
        sheetPdf.Write(sheetPath);

Hi @jake1,

Try capturing the view to a bitmap. Then draw the bitmap onto a page.

– Dale

1 Like

Hi @jake1 I am trying to achieve the same. Did you manage to get this working, and would you mind sharing the .gh file?

I am having the issue where if I print out the layout to png/jpg the size of the printed image is way larger than the size of the actual layout. I.e. if I change the image resolution only the grey part increase and layout size stays the same

Screenshot 2023-02-11 164156