0 Replies Latest reply on Nov 30, 2014 1:14 PM by Oleg Bezyaev

    Сustom paper size

    Oleg Bezyaev

      Is there any way to set a custom paper size when printing to PDF using a virtual printer?

      That's what I tried:

      int dwgSize1 = Sheet.GetSize(ref dwgWidth, ref dwgHeight);
      
          swPageSetup.Orientation = (int)swPageSetupOrientation_e.swPageSetupOrient_Landscape;
          swPageSetup.PrinterPaperSize = 256;//from here http://msdn.microsoft.com/ru-ru/library/microsoft.visualbasic.powerpacks.printing.compatibility.vb6.printer.papersize.aspx
          swPageSetup.PrinterPaperLength = 2970;
          swPageSetup.PrinterPaperWidth = 4200;
          swPageSetup.ScaleToFit = false;
          swPageSetup.UsePageSetupOnSheets = false;
              pErr = new PDFCreator.clsPDFCreatorError();
              _PDFCreator = new PDFCreator.clsPDFCreator();
              _PDFCreator.cStart("/NoProcessingAtStartup");
              swModel.Printer = "PDFCreator";
              PDFCreator.clsPDFCreatorOptions options = new PDFCreator.clsPDFCreatorOptions();
              options.UseAutosave = 1;
                  options.UseAutosaveDirectory = 1;
                  options.AutosaveDirectory = @"C:\";
                  options.AutosaveFilename = "SWDraw";
                  options.AutosaveFormat = 0;
                  options.StandardTitle = "Олег";
                  options.UseStandardAuthor = 1;
                  options.StandardAuthor = "Конструктор";
                  //options.Papersize = "66";
                  _PDFCreator.cOptions = options;
                  _PDFCreator.cSaveOptions();
                  _PDFCreator.cClearCache();
                  _PDFCreator.cPrinterStop = false;
          Int32 tryVal = swModel.Extension.UsePageSetup = (int) swPageSetupInUse_e.swPageSetupInUse_Application;
          Boolean retVal = swApp.SetUserPreferenceIntegerValue(
                        (int) swUserPreferenceIntegerValue_e.swPageSetupPrinterDrawingColor,
                        (int) swPageSetupDrawingColor_e.swPageSetup_BlackAndWhite);
          swPageSetup.HighQuality = true;
          int[] sheets = new int[1];
          swModel.Extension.PrintOut3(sheets, numberOfCopies, false, swModel.Printer, String.Empty, true);
      

       

      But the printer always prints A4 format.