Free Support Forum - aspose.com

Printing settings (recto-verso)

Hi,

Is it possible to select the printing option "Print on both sides" through code (for either .Cells or .Words)?
I looked but I can't figure out if it is possible, or where to find this setting,
nor did I find a post on the forum about this topic.

Kind regards,
Matt

Hi Matt,


Thanks for your inquiry.


Yes you can set "printing on both sides" of paper from code if your printer allows it.

  • Perform selection of appropriate printer using PrintDialog class.
  • Check if selected printer allows two sided printing
    • If yes, then set Duplex values as Vertical or Horizontal
  • Either use print preview dialog or send it directly to printer for printing.

Following code snippet depicts how to check and enable two sided printing:

AsposeWordsPrintDocument awPrintDoc = new AsposeWordsPrintDocument(doc);

awPrintDoc.PrinterSettings = printDlg.PrinterSettings;

if (awPrintDoc.PrinterSettings.CanDuplex)

{

awPrintDoc.PrinterSettings.Duplex = System.Drawing.Printing.Duplex.Vertical;

}


You can also have a quick look here to see how to Print a Document with Settings and Print Preview Dialog. Hope this helps. Please let us know if you need any further assistance.


Thank you very much for the quick and excellent reply!