Print Drawing as High Quality (C#)
This example shows how to print the active drawing document as high quality.
//---------------------------------------------
// Preconditions:
// 1. Specified drawing document exists.
// 2. Specified printer exists.
//
// Postconditions: All of the sheets of the
// specified drawing document are printed to
// the specified printer.
//----------------------------------------------
using
SolidWorks.Interop.sldworks;
using
SolidWorks.Interop.swconst;
using System;
namespace
PrintOut3ModelDocExtensionCSharp.csproj
{
partial
class
SolidWorksMacro
{
public
void Main()
{
ModelDoc2 swModel;
ModelDocExtension swModelDocExt;
PageSetup swPageSetup;
string drawing
= null;
int errors = 0;
int warnings =
0;
drawing = "C:\\Program
Files\\SolidWorks Corp\\SolidWorks\\samples\\tutorial\\advdrawings\\foodprocessor.slddrw";
swModel = swApp.OpenDoc6(drawing, (int)swDocumentTypes_e.swDocDRAWING,
(int)swOpenDocOptions_e.swOpenDocOptions_Silent,
"",
ref errors,
ref warnings);
// Set up page
swPageSetup = (PageSetup)swModel.PageSetup;
swPageSetup.Orientation = 2; //
1=Portrait '2 = Landscape
// Print all
of the sheets to the specified printer and convert to high quality
swModelDocExt = (ModelDocExtension)swModel.Extension;
// Arrays derive from Object;
in this example, IModelDocExtension::PrintOut3 method's
// sheets
input parameter
is an array of integers that is declared as follows
int[]
sheets = new
int[1];
swModelDocExt.PrintOut3(sheets,
1, false,
"\\\\CORP-PRINTA\\HPLJ4050N-R&D1",
"",
true);
}
///
<summary>
///
The SldWorks swApp variable is pre-assigned for you.
///
</summary>
public
SldWorks swApp;
}
}