I am trying to print the current pdf in viewer, but when it prints it just prints a blank page. My code here is based off of this past post: http://wpcubed.com/forum/viewtopi…4e153fd0be751be where am I going wrong?
Code
private void print_Click(object sender, System.EventArgs e) { /* file name is a global varible and it holds the postion of the current document in viewer ( example: C:\test.pdf ) */ pdfViewer2.LoadFromFile(fileName); PrintDocument pd = new PrintDocument(); pd.PrinterSettings.PrinterName = "Canon iR5000-6000 PCL6"; pd.PrintPage += new PrintPageEventHandler(this.PrintPage); pd.Print(); }
Code
public void PrintPage(object sender, PrintPageEventArgs e)
{
uint PageNo= 0;
pdfViewer2.PrintTo(PageNo, e.Graphics, 300, 300);
PageNo++;
if (PageNo > pdfViewer2.Command(WPViewPDF.commands.COMPDF_GetPageCount))
{
e.HasMorePages = false;
}
}
Alles anzeigen
Thanks,
Ed