I am trying to print to a printer directly from a windows service. We have purchased syncfusion so I am trying to use this for accomplishing that task.
I tried following these steps: https://support.syncfusion.com/kb/article/11572/how-to-print-document-in-windows-service-using-winforms-pdf-viewer?isInternalRefresh=False
When i run this locally it works like a charm. However when i let our on prem TF-server build this, i get an error.
code is as follows:
using Syncfusion.Windows.Forms.PdfViewer;
using (MemoryStream stream = new MemoryStream())
{
pdfDocument.Save(stream);
PdfViewerControl pdfViewerControl = new PdfViewerControl();
//// Load the PDF document to be printed.
////pdfViewerControl.Load("");
pdfViewerControl.Load(stream);
//// Print the PDF document silently using the printer name.
//pdfViewerControl.Print("Kyocera Upstairs");
//pdfViewerControl.Print("Kyocera Downstairs");
}
the stream variable is filled with a PDF, I did not post all the code since it is not relevant. Locally it is working like a charm and printing the PDF file as it should.
however when i let our on prem TF-server build this, i get an error. I use the same build profile as locally, so i don't understand why it is doing that. The error is:
Module\AutomaticReportSync.cs(38,26): error CS0234: The type or namespace name 'Forms' does not exist in the namespace 'Syncfusion.Windows' (are you missing an assembly reference?) [c:\TF-Agents\Agent2017-002\_work\1\s\Service\SAPSync\SAPSync.csproj]
So locally this using works, no intellisense error(s), it can build without problems, and run without problems. But TF server fails on the "build solution" step. It can also restore nuget packages without any issue
anyone got any pointers?
After conducting an investigation on our end, we have identified the root cause of the reported issue with the service application.
We assume that the Syncfusion.PdfViewer.WPF package is restored instead of the Syncfusion.PdfViewer.WinForms package on your server.
This misconfiguration of the package is the root cause of the namespace issue, which is specific to your server.