It seems that "CADImport.Printing.DrawingSize.Fit" doesn't really FIT to printer page.
To test it i've plot 2 points at:
P.Point = New DPoint(_cadImage.PureExtents.left, _cadImage.PureExtents.bottom, 0)
P.Point = New DPoint(_cadImage.PureExtents.right, _cadImage.PureExtents.top, 0)
Another question is:
How can i calculate the visible object extension after hiding layes/block ? _cadImage.PureExtents return always the same points
Code: Select all
_cadImage.GetExtents()
Dim prtForm As CADImport.Printing.PrintingForm
prtForm = New CADImport.Printing.PrintingForm
prtForm.Image = _cadImage
prtForm.CreateNewPages()
_Orientation = Orientation
_Format = PaperSize
prtForm.TypePage = CADImport.Printing.DrawingSize.Fit
ImpostaPrt2(prtForm.PrintDocument)
Private Sub ImpostaPrt2(ByRef Pd As System.Drawing.Printing.PrintDocument)
Dim ps As System.Drawing.Printing.PaperSize = Nothing
Pd.PrinterSettings.PrinterName = _PrinterName
For Each ps In Pd.PrinterSettings.PaperSizes
Select Case _Format
Case PaperFormat.A3
If ps.PaperName = "A3" Then
Exit For
End If
Case PaperFormat.A4
If ps.PaperName = "A4" Then
Exit For
End If
Case PaperFormat.A2
If ps.PaperName = "A2" Then
Exit For
End If
Case PaperFormat.A1
If ps.PaperName = "A1" Then
Exit For
End If
Case PaperFormat.A0
If ps.PaperName = "A0" Then
Exit For
End If
Case Else
End Select
Next
Pd.DefaultPageSettings.PrinterSettings.PrinterName = _PrinterName
Pd.DefaultPageSettings.PaperSize = ps
Pd.DefaultPageSettings.Margins.Left = 5
Pd.DefaultPageSettings.Margins.Right = 5
Pd.DefaultPageSettings.Margins.Bottom = 5
Pd.DefaultPageSettings.Margins.Top = 5
If _Orientation = PaperOrientation.Oriz Then
Pd.DefaultPageSettings.Landscape = True
Else
Pd.DefaultPageSettings.Landscape = False
End If
Pd.Print()
End Sub