Greetings,
I’m a junior developer of small business and I’d like to get some help with Aspose.PDF in .NET.
The issue I’m facing is I’m trying to print several documents from several trays but the configuration for selecting a tray is within PaperSourceKind and it doesn’t satisfy the conditions.
In the previous versions of Aspose.PDF for .Net, assigning just the SourceName (like “Tray 1”) would have been sufficient in order to find the tray. But since the version 23.10, it was not enough to assign the SourceName but I needed the PaperSourceKind as well.
(Thanks to this post, I was able to get a bit forward: https://forum.aspose.com/t/breaking-change-in-version-23-10-pagesettings-printersettings-papersources-not-existing/278399)
No problem, I was able to assign the following:
case "Tray 1":
return new Aspose.Pdf.Printing.PaperSource { Kind = Aspose.Pdf.Printing.PaperSourceKind.Upper, SourceName = "Tray 1" };
case "Tray 2":
return new Aspose.Pdf.Printing.PaperSource { Kind = Aspose.Pdf.Printing.PaperSourceKind.Middle, SourceName = "Tray 2"};
case "Tray 3":
return new Aspose.Pdf.Printing.PaperSource { Kind = Aspose.Pdf.Printing.PaperSourceKind.Lower, SourceName = "Tray 3" };
And it works!
The problem is when I’d like to assign to another tray like Tray 4 onwards, the only PaperSourceKind I’m able to use is PaperSourceKind.Custom
And it doesn’t print on that selected Tray (tray 4), so I tried the following:
case "Tray 4":
var nativeSettings = new System.Drawing.Printing.PrinterSettings();
nativeSettings.PrinterName = @$"\\{printLog.PrinterSettings.PrintServer}\{printLog.PrinterSettings.PrinterName}";
var paperSources = nativeSettings.PaperSources;
var paperSource = paperSources.Cast<System.Drawing.Printing.PaperSource>().SingleOrDefault(ps => ps.RawKind == 256);
return new Aspose.Pdf.Printing.PaperSource { Kind = (Aspose.Pdf.Printing.PaperSourceKind)paperSource.Kind, SourceName = paperSource.SourceName };
And still it doesn’t print on the Tray 4
Kind regards,
Elias El Harrak Samadi
EDIT #1: I was able to get the exact RawKind for Tray 4 which is 256 but even like that, it didn’t work.
EDIT #2: I’m going to add the screenshot of the papersource.
image.png (30.8 KB)