Capturing an image of the current AutoCAD document using .NET

This is a topic that has been addressed a few times on this blog, whether by posts that use the 3D graphics system to capture screenshots or the series of posts regarding the Screenshot Plugin of the Month from a few years ago. I thought it worth revisiting, though, as I noticed an API that I hadn’t used before and decided to put it through its paces.

The API is a simple one – Document.CapturePreviewImage() – and it’s been covered before on the AutoCAD DevBlog. But I thought I’d take some file-selection code from the Screenshot app and see whether it was possible to create a full-size screenshot of the current drawing window using it.

Here’s the C# implementation of a CPI command that uses the API to save a “preview” image that’s the same exact size as the document window…

Read more

Leave a Comment