Hi,
I want to export map as image and pdf. Thorugh samples I got code and I have implemented it.
For Image I have implemented below code.
myCanvas = new GdiPlusGeoCanvas();
Bitmap myImage = new Bitmap((int)wfMap.Width, (int)wfMap.Height);
myCanvas.BeginDrawing(myImage, wfMap.CurrentExtent, wfMap.MapUnit);
foreach (LayerOverlay layeroverlay in wfMap.Overlays)
{
if (layeroverlay.IsVisible == true)
{
foreach (Layer layer in layeroverlay.Layers)
{
layer.Open();
layer.Draw(myCanvas, labelsInLayers);
layer.Close();
}
}
}
myCanvas.EndDrawing();
Its working fine. In image background color is not reflected. All layers are coming correctly.
In PDF Export also same thing happens. Please guide what to add in code to get map background color in image and pdf.
Export map as Image and PDF
Hi Goral,
How about drawing the canvas on the BackgoundOverlay directly? like the blow codes:
winformsMap1.BackgroundOverlay.Draw(myCanvas);
Please let us know if it works.
Thanks,
Troy
Hi,
Thanks for reply. Ya given code works for my requirement.
Thanks & Regards,
Goral
Hi Goral,
Good to hear it works.Any other questions, please feel free to let us know.
Troy