We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Disable "Printing page x of y"

Hi,
I was wondering if it’s possible to disable the “printing page x of y” dialog?
In pdf.kit there is a property PrintPageDialog, does Aspose.Words have something similar? If not, could you please implement this feature?
Thanks, Stefan

Hi Stefan,
Thanks for posting your request.
I believe this sort of functionality is not avaliable using the standard printing methods provided by Aspose.Words at the moment. Your request has been logged and we will look into implementing this in the future. We will keep you informed of any developments.
In the mean time, if it is appropriate, you might want to try saving your document to disk first and then invoking the printing using the Process class. Hopefully this will avoid any dialogs when printing. Please see the code below:

string path = dataDir + "Document Out.pdf";
doc.Save(path);
Process printProcess = new Process();
printProcess.StartInfo.FileName = path;
printProcess.StartInfo.Verb = "print";
printProcess.StartInfo.UseShellExecute = true;
printProcess.StartInfo.CreateNoWindow = true;
printProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
printProcess.Start();

Thanks,

Hi Adam,
thanks, but the problem with the provided solution is, that I’ve no possibility to supply PrinterSettings. That’s why I cannot use this solution.
Thanks, Stefan

Hi Stefan,
Thanks for this additional information. Which printer settings are using? If you are setting the default printer manually through PrinterSettings, you can achieve this through the same process, please see the page here for details. I’m not sure how reliable it is though.
Thanks,

Hi Adam,
thanks for effort, but this solution changes the system default printer and it’s not possible to use custom papersources.
Thanks, Stefan

Hi Stefan,
Sure, we will inform you when this issue is resolved. Sorry any inconvenience.
Thanks,

Hi Stefan,
Regarding your original issue, I’m afraid I can’t reproduce it anymore. Using the following code as a test does not produce any printing dialog or messages at all.

PrinterSettings printerSetttings = new PrinterSettings() ;
printerSetttings.Copies = 1;
printerSetttings.PrinterName = "Microsoft XPS Document Writer";
printerSetttings.PrintFileName = "Print Document Out.xps";
printerSetttings.PrintToFile = true;
doc.Print(printerSetttings);

Could you please verify and clarify your issue again?
Thanks,

The issues you have found earlier (filed as WORDSNET-3799) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Can you please clarify how if / how we can disable the “Printing page x of y” dialog when using the
Aspose.Words.Rendering.AsposeWordsPrintDocument.Prnt Method?

(Words.Net 14.5.0.0.)

Hi Alan,

Thanks for your inquiry. We are in communication with our development team and will get back to you soon.

Best regards,

Hi Alan,

Thanks for being patient. The Print Progress Dialog does not appear when printing document using Document.Print method. However, this UI appears during printing document using AsposeWordsPrintDocument.Print method. In this case, to prevent the print UI from appearing, you should specify valid printer settings and a standard print controller to this method. This example illustrates how to prevent the print UI from appearing.

Document doc = new Document(MyDir + @"in.docx");
// 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();

I hope, this helps.

Best regards,