I am using this link to print a pdf to a print queue… How can i provide a username and password to access the print queue on another server?
Great! Thanks for the update!
We are afraid that Aspose.PDF does not provide any built-in method to access the printer with security credentials across the server. Windows may provide some libraries to use in C# to carry out the job for which you can explore the internet. We can also log an investigation ticket to further analyze the feasibility if you please share a bit more details with us about your complete scenario.
Thanks for taking a look anyway. I tried this code but it didnt work either.
UserCredentials credentials = new UserCredentials("", "", "");
using (SafeAccessTokenHandle userHandle = credentials.LogonUser(LogonType.Interactive)) // or another LogonType
{
WindowsIdentity.RunImpersonated(userHandle, () =>
{
System.Printing.PrintServer printServer = new System.Printing.PrintServer("");
System.Printing.PrintQueueCollection printQueues = printServer.GetPrintQueues();
var printQueue = printQueues.ToList().FirstOrDefault(q => q.Name.ToUpper() == "PRINTQUEUENAME".ToUpper());
});
}
In the end instead of trying to run this code under different credentials from my pc i copied the exe onto the server with the print queue and ran it under the specified account.
MAYBE i was making it too hard.
Looks like you have found a workaround to achieve your requirements. Please feel free to create a new topic in case you have any other requirement or face any issues.