AsposeWordsPrintDocuments seems to loose the set PaperSource when printing. Because of this we cannot set or print to the correct papertray which is causing a serious production disturbance. Source code below demonstrates how to reproduce this problem.
using Aspose.Words;
using Aspose.Words.Rendering;
using System;
using System.Drawing.Printing;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
new PrintDoc();
}
public class PrintDoc
{
public PrintDoc()
{
Document doc = new Document(); //insertdocument
PrintDocument printDoc = new PrintDocument();
// AsposeWordsPrintDocument printDoc = new AsposeWordsPrintDocument(doc);
PrinterSettings printerSettings = new PrinterSettings();
printerSettings.PrinterName = "HP LaserJet 4100 Series PS";
printDoc.PrinterSettings = printerSettings;
pageSettings = new PageSettings();
PaperSource source = new PaperSource(); //RawKind default: 257
source.RawKind = 262;
pageSettings.PaperSource = source;
printDoc.QueryPageSettings += new QueryPageSettingsEventHandler(printDoc_QueryPageSettings);
printDoc.PrintPage += new PrintPageEventHandler(printDoc_PrintPage);
printDoc.Print();
}
public void printDoc_QueryPageSettings(object sender, QueryPageSettingsEventArgs ev)
{
ev.PageSettings = pageSettings;
Console.Write(ev.PageSettings.PaperSource.RawKind); //RawKind= PrintDocument: 262, AsposeWordsPrintDocument: 262
}
public void printDoc_PrintPage(object sender, PrintPageEventArgs ev)
{
Console.Write(ev.PageSettings.PaperSource.RawKind); //RawKind= PrintDocument: 262, AsposeWordsPrintDocument: 0
}
private PageSettings pageSettings;
}
}
}