Hi Allan,
Thanks for your inquiry. Please check following documentation link to print PDF to a specific Printer and also check sample code for printing PDF document from memory stream using print dialogue. Hopefully it will help you to accomplish the task.
Printing Pdf to an XPS printer
FileStream fs = new FileStream(myDir + “HelloWorld.pdf”, FileMode.Open, FileAccess.Read);
byte[] tmpBytes = new byte[fs.Length];
fs.Read(tmpBytes, 0, Convert.ToInt32(fs.Length));
MemoryStream mystream = new MemoryStream(tmpBytes);
MyStream myStream = new MyStream(mystream);
PdfViewer viewer = new PdfViewer();
viewer.BindPdf(mystream);
viewer.PrintAsImage = true;
viewer.AutoResize = false;
// viewer.Resolution = 600;
viewer.AutoRotate = false;
//viewer.PrintPageDialog = true;
System.Windows.Forms.PrintDialog printDialog = new System.Windows.Forms.PrintDialog();
if (printDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)<o:p></o:p>
{
System.Drawing.Printing.PrinterSettings ps = printDialog.PrinterSettings;<o:p></o:p>
System.Drawing.Printing.PageSettings pgs = new System.Drawing.Printing.PageSettings();
pgs.PaperSize = new System.Drawing.Printing.PaperSize(“A4”, 827, 1169);
pgs.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
pgs.Landscape = true;
// ps.PrinterName = “Adobe PDF”;
// ps.PrintToFile = true;
// ps.PrintFileName = myDir + “testoutprint.pdf”;
viewer.PrintDocumentWithSettings(pgs, ps);
}
viewer.Close();
Please feel free to contact us for any further assistance.
Best Regards,