Exemplo n.º 1
0
        public static void CachePrinterSettings(string dataDir)
        {
            // ExStart:CachePrinterSettings
            //Load the Word document
            Document doc = new Document(dataDir + "TestFile.doc");

            // Build layout.
            doc.UpdatePageLayout();

            // Create settings, setup printing.
            PrinterSettings settings = new PrinterSettings();

            settings.PrinterName = "Microsoft XPS Document Writer";

            // Create AsposeWordsPrintDocument  and cache settings.
            AsposeWordsPrintDocument printDocument = new AsposeWordsPrintDocument(doc);

            printDocument.PrinterSettings = settings;
            printDocument.CachePrinterSettings();

            printDocument.Print();

            // ExEnd:CachePrinterSettings
            Console.WriteLine("\nDocument is printed successfully.");
        }
Exemplo n.º 2
0
        public void CachePrinterSettings()
        {
            //ExStart:CachePrinterSettings
            Document doc = new Document(MyDir + "Rendering.docx");

            doc.UpdatePageLayout();

            PrinterSettings settings = new PrinterSettings {
                PrinterName = "Microsoft XPS Document Writer"
            };

            // The standard print controller comes with no UI.
            PrintController standardPrintController = new StandardPrintController();

            AsposeWordsPrintDocument printDocument = new AsposeWordsPrintDocument(doc)
            {
                PrinterSettings = settings,
                PrintController = standardPrintController
            };

            printDocument.CachePrinterSettings();

            printDocument.Print();
            //ExEnd:CachePrinterSettings
        }
Exemplo n.º 3
0
 public void PrintWordDocument(byte[] fileContents, string documentName)
 {
     using (MemoryStream ms = new MemoryStream(fileContents))
     {
         var doc = new Document(ms);
         var printDocument = new AsposeWordsPrintDocument(doc);
         printDocument.DocumentName = documentName;
         printDocument.Print();
     }
 }
        public static void Run()
        {
            // ExStart:PrintProgressDialog
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_RenderingAndPrinting(); 
            // Load the documents which store the shapes we want to render.
            Document doc = new Document(dataDir + "TestFile RenderShape.doc");
            // Obtain the settings of the default printer
            System.Drawing.Printing.PrinterSettings settings = new System.Drawing.Printing.PrinterSettings();

            // The standard print controller comes with no UI
            System.Drawing.Printing.PrintController standardPrintController = new System.Drawing.Printing.StandardPrintController();

            // Print the document using the custom print controller
            AsposeWordsPrintDocument prntDoc = new AsposeWordsPrintDocument(doc);
            prntDoc.PrinterSettings = settings;
            prntDoc.PrintController = standardPrintController;
            prntDoc.Print();            
            // ExEnd:PrintProgressDialog
        }
Exemplo n.º 5
0
        public static void Run()
        {
            // ExStart:PrintProgressDialog
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_RenderingAndPrinting();
            // Load the documents which store the shapes we want to render.
            Document doc = new Document(dataDir + "TestFile RenderShape.doc");

            // Obtain the settings of the default printer
            System.Drawing.Printing.PrinterSettings settings = new System.Drawing.Printing.PrinterSettings();

            // The standard print controller comes with no UI
            System.Drawing.Printing.PrintController standardPrintController = new System.Drawing.Printing.StandardPrintController();

            // Print the document using the custom print controller
            AsposeWordsPrintDocument prntDoc = new AsposeWordsPrintDocument(doc);

            prntDoc.PrinterSettings = settings;
            prntDoc.PrintController = standardPrintController;
            prntDoc.Print();
            // ExEnd:PrintProgressDialog
        }