ds-blue-logo
Preview  |  SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
FSFrancisco Salema07/08/2019

Good evening everyone,

I am quite new to macro development in solidworks and I have been struggling a bit to print a A3 drawing in a A4 paper. So far what I have is:

Dim swApp As SldWorks.SldWorks
Dim swModel As ModelDoc2
Dim ps As PageSetup
Dim swDrawing As DrawingDoc
Dim swSheet As Sheet
Dim sheetPropertis As Variant
Dim sheetPaperSize As Long
Dim printSpec As SldWorks.PrintSpecification

Sub main()


Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc

Set ps = swModel.PageSetup
Set printSpec = swModel.Extension.GetPrintSpecification

Set swDrawing = swModel
Set swSheet = swDrawing.GetCurrentSheet

sheetProperties = swSheet.GetProperties2
sheetPaperSize = sheetProperties(0)

Debug.Print "Printing drawing " & swModel.GetTitle & " with paper size: " & sheetPaperSize

ps.ScaleToFit = True
ps.PrinterPaperSize = 7
ps.PrinterPaperSource = 8
ps.Orientation = 2 'Landscape

swModel.Extension.PrintOut4 "", "", ps

End Sub

And this prints the A3 drawing in A4 paper, but it does not come well scaled, the actual drawing is smaller then the page, creating some big margins.

Does anyone have a clue on how to solve this?

Thank you.