Printing and margins
Moderators: SDS, support, admin
Printing and margins
i'm using a kind of silent print with this code to Bullzip pdf printer , but in every file (and also in the standard preview) i see always a lot of margin space that is wasted.
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
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
- Attachments
-
- PROVA.PDF.zip
- Test pdf (B/W) (rename to pdf)
- (10.81 KiB) Downloaded 1292 times
Re: Printing and margins
Hello.
Unfortunateiy it seems the PROVA.PDF.zip file that you upload to this topic is corrupted and I couldn't see the picture. However the issue can depend on margins of CADImage object. Please try to add the following strings to your code:when create _cadImage object (before loading file) and see the results of your printing method.
Alexander.
Unfortunateiy it seems the PROVA.PDF.zip file that you upload to this topic is corrupted and I couldn't see the picture. However the issue can depend on margins of CADImage object. Please try to add the following strings to your code:
Code: Select all
_cadImage.IsWithoutMargins = True
_cadImage.BorderSize = 0
Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
Re: Printing and margins
... "fit" is useful for use all page , but how can i maintain the correct aspect ratio ?
It seems that print preview is different from EXE and sources.
The right version of the preview seems to be the second one (white background), why with this
i get a streched image ?
It seems that print preview is different from EXE and sources.
The right version of the preview seems to be the second one (white background), why with this
Code: Select all
_cadImage.ClearSelection()
_cadImage.ClearMarkers()
_cadImage.GetExtents()
Dim prtForm As CADImport.Printing.PrintingForm
prtForm = New CADImport.Printing.PrintingForm
prtForm.TypePage = CADImport.Printing.DrawingSize.Fit
prtForm.Image = _cadImage
prtForm.TypePage = CADImport.Printing.DrawingSize.Fit
prtForm.CreateNewPages()
_Orientation = Orientation
_Format = PaperSize
prtForm.TypePage = CADImport.Printing.DrawingSize.Fit
- Attachments
-
- Example
- diff_print_prev.jpg (244.75 KiB) Viewed 23095 times
Re: Printing and margins
Hello.
You don't need specify the page orientation - its calculated automatically. This is the cause of distortion. A4 format used by default. Just specify the page size, if different from A4 and you will get the correct result:
Alexander.
You don't need specify the page orientation - its calculated automatically. This is the cause of distortion. A4 format used by default. Just specify the page size, if different from A4 and you will get the correct result:
Code: Select all
prtForm = New CADImport.Printing.PrintingForm
Dim size As System.Drawing.Printing.PaperSize
size = New System.Drawing.Printing.PaperSize
REM: please note, setting PaperKind.A5Rotated will result in distorted print because the page orientation calculated automatically
size.RawKind = System.Drawing.Printing.PaperKind.A5
prtForm.PrintDocument.DefaultPageSettings.PaperSize = size
prtForm.PrintDocument.PrinterSettings.PrinterName = printer_name
prtForm.TypePage = CADImport.Printing.DrawingSize.Fit
prtForm.Image = loaded_CADImage
prtForm.Print(True)
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support