AnsweredAssumed Answered

Print tasks - Lookup Sheet Size to Print Landscape or Portrait

Question asked by Shaun Jalbert on Nov 2, 2016
Latest reply on Nov 10, 2016 by Shaun Jalbert

We've had our drawing templates in a "Landscape" format (34"L x 22"H) as long as we've been using SolidWorks.

We've also been using Print Tasks and our API was controlled with a tidbit of code that forced the task to use the "Landscape" format.

Below is a snippit of that code.


'************* Start of Print task API Specs *************

' Sheet Size Option  (34"x22" = 132)

swPageSetup.PrinterPaperSize = 132


' Printer Source Option (Adobe Distiller = 7)

swPageSetup.PrinterPaperSource = 7


' Scale Percentage Option (100% = 100)

swPageSetup.Scale2 = 100


' Scale To Fit Option (True, False)

'swPageSetup.ScaleToFit = True


' Sheet Orientation Option  (1=Portrait,  '2 = Landscape)

swPageSetup.Orientation = 2

'************* End of Print task API Specs *************


Because of some formatting issues within SolidWorks not liking rotated views, we're now using "Portrait" formats (22"L x 34"H) for some drawings.

Because of this, our code is still forcing it to print in Landscape and only half of the drawing shows up.

Is there a way to put in a lookup function for the sheet width and and if statement based on that function?


Look up Sheet Width = x

If x = 34", then swPageSetup.Orientation = 2

If x = 22", then swPageSetup.Orientation = 1