public static Print ( Document document, string printerName, string jobName, bool isWait ) : void | ||
document | Document | |
printerName | string | |
jobName | string | Job name. Can be null. |
isWait | bool | True to wait for the job to complete. False to return immediately after submitting the job. |
리턴 | void |
public static void Print(Document document, string printerName, string jobName, bool isWait)
{
Console.WriteLine("Print");
if (document == null)
throw new ArgumentNullException("document");
// Use Aspose.Words to convert the document to XPS and store in a memory stream.
MemoryStream stream = new MemoryStream();
document.Save(stream, SaveFormat.Xps);
stream.Position = 0;
Console.WriteLine("Saved as Xps");
Print(stream, printerName, jobName, isWait);
Console.WriteLine("After Print");
}
// ExEnd:XpsPrint_PrintDocument
XpsPrintHelper::Print ( Stream stream, string printerName, string jobName, bool isWait ) : void |
public static void Run() { //ExStart:PrintDocViaXpsPrint // The path to the documents directory. string dataDir = RunExamples.GetDataDir_RenderingAndPrinting(); // Open a sample document in Aspose.Words. Document document = new Document(dataDir + "TestFile.doc"); // Specify the name of the printer you want to print to. const string printerName = @"\\COMPANY\Brother MFC-885CW Printer"; // Print the document. XpsPrintHelper.Print(document, printerName, "My Test Job", true); //ExEnd:PrintDocViaXpsPrint }