3 Replies Latest reply on Dec 22, 2016 7:56 AM by Ivana Kolin

    SW2015 API Paper Size Setting

    Rohan Jhunjhunwala


      I am developing an application in C# to automate the release of parts and assemblies at my company, and part of that process is printing the drawing. I wrote the following print function:

      void print(SldWorks.ModelDoc2 doc)
                  ModelDocExtension swModExt = default(ModelDocExtension);
                  PageSetup pset;
                  pset = (PageSetup)doc.PageSetup;
                  pset.Orientation = 2; //1=portrait, 2=landscape
                  pset.ScaleToFit = true;
                  pset.PrinterPaperSize = 4; //1=8.5x11, 4=11x17
                  swModExt = (ModelDocExtension)doc.Extension;
                  swModExt.PrintOut3(null, 1, false, "", "", true);
                  TextBox1.Text = TextBox1.Text + "\r\n\t" + "Printed " + doc.GetPathName();
                  using (StreamWriter w = File.AppendText("T:\\USERS\\JUNK\\For Rohan\\log\\swlog.txt"))
                      log("Printed " + doc.GetPathName(), w);

      The issue is the paper size is not always 11x17 as I would expect, but rather is set to the previous paper size printed from Solidworks. I would like the drawing to always be printed in 11x17.


      Any help would be much appreciated!



      Rohan Jhunjhunwala