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.
(我在文档上创建并合并了多个PDF文档,然后将该文档转换为Word文档,然后将该文档发送到打印机以双面模式进行打印,一切正常,但是它以不正确的顺序打印文档页面。)
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. (我尝试使用多种解决方案,例如不进行转换,而仅将其打印为PDF,虽然效果很好,但打印时速度太慢。)
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.
(先感谢您。)
ask by Mahmoud Fakhoury translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…