Hi Summer,
Thanks for you reply and also thanks for the sample project in the attachment. The solution of increasing the page dimensions solves the problem of scale but creates a new problem for me. When I use that solution all PrinterLayer objects shift to the right by the amount of HardMarginX, in my case 0.13 inches. The also shift down by the amount of HardMarginY.
My workaround is to create the RectangleShape that represents the drawing area using the original page size (850 X 1100 in this case). I then shift all the printer layers to the left by HardMarginX and up by HardMarginY before printing. Following the print, the PrinterLayers are returned to their original positions.
In this way I am hopeful all printer devices will produce the desired results. Here is the code I am using.
01.DimoPrintDocumentAsNewPrintDocument()02.WithoPrintDocument03..PrinterSettings = oPrinterSettings04..DefaultPageSettings.Landscape =True05.IfoPagePrinterLayer.Orientation = PrinterOrientation.PortraitThen06..DefaultPageSettings.Landscape =False07.EndIf08..DefaultPageSettings.PaperSize =NewPaperSize("AnsiA",CInt(850),CInt(1100))09.EndWith10.11.DimoRectAsRectangleShape12.DimoNewUpperLeftAsPointShape13.DimoNewLowerRightAsPointShape14.DimoNewRectAsRectangleShape15.16.DimoPrinterCanvasAsPrinterGeoCanvas =NewPrinterGeoCanvas()17.18.‘***** Create a rectangle to represent the drawing area for the document19.oPrinterCanvas.DrawingArea =NewRectangle(0, 0, 850, 1100)20.21.’***** Start the drawing process22.oPrinterCanvas.BeginDrawing(oPrintDocument, oPagePrinterLayer.GetBoundingBox(), PageLayout.MapUnit)23.24.‘***** Loop through all of the PrintingLayers in the PrinterInteractiveOverlay25.’***** and print all of the except for the PagePrinterLayer26.DimlabelsInAllLayersAsCollection(Of SimpleCandidate) =NewCollection(Of SimpleCandidate)()27.ForEachoPrinterLayerAsPrinterLayerInoPrinterOverLay.PrinterLayers28.oPrinterLayer.IsDrawing =True29.IfNot(TypeOfoPrinterLayerIsPagePrinterLayer)Then30.oPrinterLayer.Open()31.'***** Shift the PrinterLayer to the right and up by HardMarginX and HardMarginY32.oRect = (oPrinterLayer.GetPosition(PrintingUnit.Inch))33.oNewUpperLeft =NewPointShape(oRect.UpperLeftPoint.X - 0.13, oRect.UpperLeftPoint.Y + 0.06)34.oNewLowerRight =NewPointShape(oRect.LowerRightPoint.X - 0.13, oRect.LowerRightPoint.Y + 0.06)35.oNewRect = (NewRectangleShape(oNewUpperLeft, oNewLowerRight))36.oPrinterLayer.SetPosition(oNewRect, PrintingUnit.Inch)37.oPrinterLayer.Draw(oPrinterCanvas, labelsInAllLayers)38.oPrinterLayer.SetPosition(oRect, PrintingUnit.Inch)39.EndIf40.oPrinterLayer.IsDrawing =False41.NextoPrinterLayer42.43.oPrinterCanvas.EndDrawing()
This seems to be getting the job done for me.
Thanks,
Steve