I have been using code to Print a PDF file for awhile now. But since version 6.0 my code dose not work anymore. Can some one help me with this please. It is crushing on printing the header label text layer.
Dim iLoop1 As Integer
For iLoop1 = 0 To lPagePrinterLayers.Count - 1
pdfGeoCanvas1.BeginDrawing(pdfPage, lPagePrinterLayers.Item(iLoop1).GetBoundingBox(), wmMap.MapUnit)
pdfGeoCanvas1.EnableCliping = True
' Iterate over the printer layers and draw each layer
Dim coLabelsInAllLayers As New Collection(Of SimpleCandidate)()
For Each plPrinterLayer In lPrinterInteractiveOverlays.Item(iLoop1).PrinterLayers
plPrinterLayer.IsDrawing = True
If Not plPrinterLayer.IsOpen Then
plPrinterLayer.Open()
End If
If Not TypeOf plPrinterLayer Is PagePrinterLayer Then
plPrinterLayer.Draw(pdfGeoCanvas1, coLabelsInAllLayers)
End If
plPrinterLayer.IsDrawing = False
Next plPrinterLayer
Next
pdfGeoCanvas1.EndDrawing()
This is the Error I get now.
NullReferenceException
Object reference not set to an instance of an object.
Source : MapSuiteCore
Stack Trace:
at ThinkGeo.MapSuite.Core.GeoCanvas.DrawText(String text, GeoFont font, GeoBrush fillBrush, GeoPen haloPen, IEnumerable`1 textPathInScreen, DrawingLevel drawingLevel, Single xOffset, Single yOffset, Single rotateAngle)
at ThinkGeo.MapSuite.Core.GeoCanvas.DrawTextWithWorldCoordinate(String text, GeoFont font, GeoBrush fillBrush, GeoPen haloPen, Double upperLeftXInWorld, Double upperLeftYInWorld, DrawingLevel drawingLevel)
at ThinkGeo.MapSuite.Core.GeoCanvas.DrawTextWithWorldCoordinate(String text, GeoFont font, GeoBrush fillBrush, Double upperLeftXInWorld, Double upperLeftYInWorld, DrawingLevel drawingLevel)
at ThinkGeo.MapSuite.Core.LabelPrinterLayer.DrawCore(GeoCanvas canvas, Collection`1 labelsInAllLayers)
at ThinkGeo.MapSuite.Core.Layer.Draw(GeoCanvas canvas, Collection`1 labelsInAllLayers)
at ezMapPrinter.MapWallPrintPreview.btnGeneratePDF_Click(Object sender, EventArgs e) in C:\EZ911NET\CADApplication\ezMapPrinter\MapWallPrintPreview.vb:line 673
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)