How To: Save to Bitmap Programatically


https://www.nevron.com/Forum/Topic14234.aspx
Print Topic | Close Window

By Ashley Davy - 3 Years Ago
I have the following code which exports to a PNG format.  I want to export to Bitmap but I cannot find the NBitmapEncoderSettings class to reference.  How can I use the coding method below to export to a bitmap?

// Configure the decoder
    NPngEncoderSettings ImgPngEncoder = new NPngEncoderSettings();
    ImgPngEncoder.ColorType = ENPngColorType.TrueColorWithAlpha;
    ImgPngEncoder.CompressionLevel = Nevron.Nov.Compression.ENCompressionLevel.BestCompression;

    // Export To Stream
    NDrawingRasterImageExporter ImgRasterExporter = new Nevron.Nov.Diagram.Export.NDrawingRasterImageExporter((Nevron.Nov.Diagram.NDrawingDocument)DrawNOV.View.Content.OwnerDocument);
    ImgRasterExporter.SaveToStream(MemStrPng, ImgRasterExporter.GetDocumentContentBounds(), 300, NImageFormat.Png, ImgPngEncoder);

    MemStrPng.Position = 0;

    // Save To file
    MemStrPng.WriteTo(new FileStream(@"C:\AD_ATF\AD15.png", FileMode.Create));
By Nevron Support - 5 Months Ago
To export the active page of a drawing to a bitmap (BMP) file, you can use the following code:


NDrawingRasterImageExporter imageExporter = new NDrawingRasterImageExporter(drawingView.Content);
using (Stream stream = File.Create(@"C:\ExportedImage.bmp"))
{
  imageExporter.SaveToStream(stream, NImageFormat.Bmp);
}


For more information on raster image exports of NOV Diagram, please take a look at the following documentation topic:
Drawing Raster Image Export