Using printdocumnet and printdialog
-
Hi, I am trying to print a pdf using the printdocument and printdialog by passing a file name using the opendialog. This is my code im c1 As OpenFileDialog = New OpenFileDialog c1.InitialDirectory = "c:\" c1.Filter = "PDF Files (*.pdf)|*.pdf" If (c1.ShowDialog() = DialogResult.OK) Then lblFileName.Text = c1.FileName file = lblFileName.Text End If PrintDocument1.DocumentName = file PrintDialog1.ShowDialog() PrintDocument1.Print() Anytime I try this it does not print anything. Can anyone help please
-
Hi, I am trying to print a pdf using the printdocument and printdialog by passing a file name using the opendialog. This is my code im c1 As OpenFileDialog = New OpenFileDialog c1.InitialDirectory = "c:\" c1.Filter = "PDF Files (*.pdf)|*.pdf" If (c1.ShowDialog() = DialogResult.OK) Then lblFileName.Text = c1.FileName file = lblFileName.Text End If PrintDocument1.DocumentName = file PrintDialog1.ShowDialog() PrintDocument1.Print() Anytime I try this it does not print anything. Can anyone help please
There is no PDF support in .NET. You need to buy a third party library for that. The print dialog DocumentName in general, does not magically print a document for you in any case. You need to impliment printing in all cases. Perhaps you should try reading some documentation ?
Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp