XpsPrintHelper on Server 2012R2

I’m moving my server side console to a new Server 2012 R2 server and finding that the printing is not printing. The code does not return any errors to .NET or windows of any failure but it is not printing.

Not sure where the problem can be. Does anyone know if the XpsPrintHelper routines work with Server 2012R2?

Hi Steve,


Thanks for your inquiry.

Please try following code snippet for testing at your end. This code does not use Aspose.Words at all. So if it does not work on your end, it means the problem is somewhere on your side (server/printer configuration)

PrintDocument doc = new PrintDocument();

doc.PrinterSettings.PrinterName = @"\127.0.0.1\some printer";

doc.PrintPage += Doc_PrintPage;

doc.Print();

============================================================================

private void Doc_PrintPage(object sender, PrintPageEventArgs e)

{

e.Graphics.DrawImage(Image.FromFile(@“Common\test.jpg”), e.MarginBounds.Left, e.MarginBounds.Top);

}

This code just prints an image. Moreover, please try the Document.Print method in simple console application at Windows 2012 R2. Hope, this helps.


Best regards,

I did try the above code on the server. Works but not consistently.



I am working on moving a batch print job from 2008 R2 using XPS to 2012 R2 using XPS, ASPOSE.WORDS or ASPOSE.PDF. I have attached a zip file of the test program I am using to test the printing of a word document. The test program takes the print server name, printer name and a type of print to use. Either WORD PDF or XPS. The test is set up to print 5 documents. This test program works just fine on 2008 R2, meaning I get 5 documents, and testing the 3 different ways of printing, each print 5 documents. On 2012R2 the printing is sporadic, meaning for each type of print I do not get 5 prints, I will only receive 1 or 2.



I’m not a server 2012r2 expert but is there configuration requirements that I’m missing or is aspose not compatible with 2012r2 or ??



This zip file contains project files as well as executable for the test program I’m using. It is built using VS2015



Any help would be greatly appreciated.

Hi Steve,

Thanks for your inquiry. We are working over your query and will get back to you soon.

Best regards,

Hi Steve,


Thanks for being patient. I managed to successfully print your “REGL_3ad07a23-a107-4e1e-8d60-be52213a584b.docx” Word document to XPS file using “Microsoft XPS Document Writer” printer over Windows Server 2012 R2 machine. I used the latest version of Aspose.Words for .NET 16.2.0 on my end for testing. Could you please also upgrade to the latest version of Aspose.Words and see how it goes on your end? It might be that the problem occurs on your end because your printer is not able to print PDF files. What is the name of your printer you’re getting this problem with?

Best regards,