code run but printer
print blank page
var files = Directory.GetFiles(Server.MapPath("/Document"));
if (files.Length != 0)
{
using (var pdoc = new PrintDocument())
using (var pdi = new System.Windows.Forms.PrintDialog { Document = pdoc, UseEXDialog = false })
{
// pdoc.PrinterSettings.PrinterName ="" ;
pdoc.PrinterSettings = pdi.PrinterSettings;
// ************************************
// Pay attention to the following line:
pdoc.PrintPage += pd_PrintPage;
// ************************************
foreach (var file in files)
{
pdoc.DocumentName = file;
pdoc.Print();
}
}
}

Sachin SinghRank #66 · 26.2K reputationPosted Jun 18, 2021, 9:43 AM EDT
Leon DRank #851 · 2.6K reputationPosted Jun 20, 2021, 9:08 PM EDT