Hello everybody this is my code that I try get a file with Open File Dialog And print the file
But its printing an Empty page :( :(
please help me :)
private void tsmprint_Click(object sender, EventArgs e)
{
try
{
if (openFileDialog1.ShowDialog()==DialogResult.OK)
{
PrintDocument Pd = new PrintDocument();
Pd.DocumentName = openFileDialog1.FileName;
printDialog1.Document = Pd;
if (printDialog1.ShowDialog()==DialogResult.OK)
{
Pd.Print();
}
}
}
catch (Exception)
{
}
}
Talk1:
Related : stackoverflow.com/questions/5566186/print-pdf-in-c-sharp You cannot directly print PDF using PrintDocument. Use PDF Viewer or third party library.
Solutions1
The easiest way is to use