Hi,
I used the following code in a UnitTest and it worked fine.
Now that I run it as a WebService (Microsoft WCF under WinServer 2008) I get an error:
"Settings to access printer 'PR1046 (HP LaserJet P3010 Series)' are not valid."
My questions: What is the difference in using a method from a WebService compared to tho local usage? What can I do to find out what settings are missing or invalid? (i only set the PrinterName)
Thats the code:
byte[] pdfData = RetrievePdf(id, requestContext); // get PDF-Data as byte[]
PdfViewer viewer = new PdfViewer();
viewer.AutoResize = true; //print the file with adjusted size
viewer.AutoRotate = true; //print the file with adjusted rotation
viewer.PrintPageDialog = false;//do not produce the page number dialog when printing
System.Drawing.Printing.PrinterSettings ps = new System.Drawing.Printing.PrinterSettings();
ps.PrinterName = printer;
PageSettings pgs = new PageSettings();
pgs.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
viewer.PrintLargePdf(new MemoryStream(pdfData), pgs, ps);
viewer.ClosePdfFile();
kind regards
Carsten