Profile Picture

How to programmatically save the drawing as PNG with transparent background

Posted By Ashley Davy 3 Years Ago

How to programmatically save the drawing as PNG with transparent...

Author
Message
Ashley Davy
Question Posted 3 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 35, Visits: 119
I have a require to save the drawing as a PNG file with a transparent background.  I have been looking at the code but I am not sure how to tie it all together.  Below is what I have so far but I am not sure how to apply the Encoder Settings and make the background transparent.

Thanks,
Ashley


Dim ImgPngEncoder As NPngEncoderSettings = New NPngEncoderSettings()
   ImgPngEncoder.ColorType = ENPngColorType.TrueColorWithAlpha
   ImgPngEncoder.CompressionLevel = Nevron.Nov.Compression.ENCompressionLevel.BestCompression

   Dim ImgRasterExporter As NDrawingRasterImageExporter = New NDrawingRasterImageExporter(Draw2.View.Content.OwnerDocument)
  
   ImgRasterExporter.SaveToFile("C:\AD_ATF\AD1.png")


Nevron Support
Posted 3 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)

Group: Forum Members
Last Active: Last Year
Posts: 3,039, Visits: 3,746
Hi,

By default the page has white background. Set the background the page to a transparent color fill and the exported PNG image will have transparent background, too:

drawingView.ActivePage.BackgroundFill = new NColorFill(NColor.Transparent);



Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic