Printing word document “Docx” with incorrect order C#

  • Thread starter Thread starter Mahmoud-Fakhoury
  • Start date Start date
M

Mahmoud-Fakhoury

Guest
I created and merged multi PDF documents together in on document then i converted this document into word document and after that i sent this document to the printer to print it in Duplex Mode, everything works well but it prints document pages not in the correct order. I tried to use multi solutions such as not to convert it and just print it as PDF, it works well but it's too slow by printing. I tried also to use Raw Print but it doesn't support duplex printing, finally i used the code below: It works fine and fast but it prints all pages in incorrect order, otherwise i sent the document direct to printer and deactivated the spooler but it doesn't worked also...


using Microsoft.Office.Interop.Word;


private static void PrintDoc(this string filePath, string printerName, int noOfCopies = 1)
{
try
{
object missing = Missing.Value;
object path = filePath;
var word = new Application();
var doc = word.Documents.Add(ref path, ref missing, ref missing, ref missing);
word.ActivePrinter = printerName;
object background = false;
object copies = noOfCopies;
object printToFile = false;
object collate = false;
doc.PrintOut(
ref background,
ref missing,
ref missing,
ref missing,
ref missing,
ref missing,
ref missing,
ref copies,
ref missing,
ref missing,
ref printToFile,
ref collate,
ref missing,
ref missing,
ref missing,
ref missing,
ref missing,
ref missing);
doc.Close(ref missing, ref missing, ref missing);
word.Quit(ref missing, ref missing, ref missing);
}
catch (Exception ex)
{
ErrorHandler.Error(ex.Message, nameof(PrintDoc));
}
}


can you please provide a solution to incorrect page orders by printing?

Thank you in advance.

Continue reading...
 
Back
Top