Hi there,
I’m using the printerGeoCanvas to print out a specific area of the map (see below)
As you can see, the polygons align with the raster image behind it, but on actual print, the vector features are in the correct position, but the raster seems stretched from the top left corner of the MapPrinterLayer and then gives this result:
This only seems to be an issue for printerGeoCanvas, PDFGeoCanvas and PlatformGeoCanvas show the expected results.
The attached code is what is used to send to printer:
// Handle sending the page to the printer
private void ubtnPrint_Click(object sender, EventArgs e)
{
//PrintDialog settings PrintDialog printDlg = new PrintDialog();
// (a)(1) Set up the print document PrintDocument printDocument = new PrintDocument();
printDlg.Document = printDocument; printDlg.AllowSelection = false; printDlg.AllowSomePages = false; printDlg.Document.DefaultPageSettings.Landscape = pagePrinterLayer.Orientation == PrinterOrientation.Landscape; printDlg.Document.DefaultPageSettings.PaperSize = GetPrintPreviewPaperSize(pagePrinterLayer); printDlg.Document.DefaultPageSettings.Margins = new Margins(GetMarginInHInch(), GetMarginInHInch(), GetMarginInHInch(), GetMarginInHInch()); printDlg.Document.OriginAtMargins = false;
if (printDlg.ShowDialog() == DialogResult.OK) { // (b) Set up PrinterGeoCanvas PrinterGeoCanvas printerGeoCanvas = new PrinterGeoCanvas(); printerGeoCanvas.DrawingArea = printDlg.Document.DefaultPageSettings.Bounds; printerGeoCanvas.DrawingQuality = DrawingQuality.HighQuality; printerGeoCanvas.ClippingArea = pagePrinterLayer.GetBoundingBox();
var simpleCandidates = new Collection<SimpleCandidate>(); printerGeoCanvas.BeginDrawing(printDlg.Document, pagePrinterLayer.GetBoundingBox(), mapPrinterLayer.MapUnit);
foreach (PrinterLayer layer in printerOverlay.PrinterLayers) { layer.Draw(printerGeoCanvas, simpleCandidates); }
printerGeoCanvas.EndDrawing();
} }
On another less pressing issue, the scalebar printer layer appears to be slightly misaligned, as the black bar parts of the scale bar appear to float up and left ever so slightly. (I’m unable to show an example of this).
I hope to hear from you soon,
Regards,
Zak