How to export the GoDocument out as an image file

Hi,

Just a rudimentary question: Is there any direct way to export a go diagram to an image file?

Thanks,

Collin

For a bitmap rendition, you can call the GoView.GetBitmapFromCollection method, and save the resulting Bitmap object to a file.



C#:



Bitmap bmp = aGoView.GetBitmapFromCollection(aGoView.Document);



Stream outf = File.OpenWrite(@“C:\temp\MyView.png”);



bmp.Save(outf, ImageFormat.Png);



outf.Close();







VB.NET:



Dim bmp as Bitmap = aGoView.GetBitmapFromCollection(aGoView.Document)



Dim outf as Stream = File.OpenWrite(“C:/temp/MyView.png”)

bmp.Save(outf, ImageFormat.Png)



outf.Close()



Note that this only results in a picture of a diagram—you cannot read the image in and easily reconstruct the document and its objects in memory.



You can also use other ImageFormat values, such as Jpg (JPEG), Gif (GIF) or Bmp (bitmap). But we recommend the PNG format for best quality.