EDN Admin
Well-known member
Hello all,
I am trying to print ONLY specific pages (e.g only the first page) from some files but I can not get it work. Can anyone help?
Below is my code:
<div style="color:black; background-color:white
<pre><span style="color:blue Private <span style="color:blue Sub Button1_Click(<span style="color:blue ByVal sender <span style="color:blue As System.Object, <span style="color:blue ByVal e <span style="color:blue As System.EventArgs) <span style="color:blue Handles Button1.Click
<span style="color:blue Dim psi <span style="color:blue As <span style="color:blue New ProcessStartInfo
<span style="color:blue Dim Line <span style="color:blue As <span style="color:blue Integer
<span style="color:blue Dim SelectedDocument <span style="color:blue As <span style="color:blue String
psi.UseShellExecute = <span style="color:blue True
psi.Verb = <span style="color:#a31515 "printto"
psi.WindowStyle = ProcessWindowStyle.Hidden
PrintDialog1.AllowSelection = <span style="color:blue True
PrintDialog1.AllowSomePages = <span style="color:blue True
PrintDialog1.AllowCurrentPage = <span style="color:blue True
PrintDialog1.ShowDialog()
psi.Arguments = PrintDialog1.PrinterSettings.PrinterName.ToString()
Line = Richtextbox2.Lines.<span style="color:blue Count
<span style="color:blue For Line = 0 <span style="color:blue To Richtextbox2.Lines.<span style="color:blue Count - 1
Richtextbox2.<span style="color:blue Select(Richtextbox2.GetFirstCharIndexFromLine(Line), Richtextbox2.Lines(Line).Length)
Richtextbox2.<span style="color:blue Select()
SelectedDocument = Richtextbox2.SelectedText
<span style="color:blue If Richtextbox2.SelectionBackColor = Color.Aqua <span style="color:blue Then
psi.FileName = SelectedDocument
Process.Start(psi)
<span style="color:blue End <span style="color:blue If
<span style="color:blue Next
Line = RichTextBox1.Lines.<span style="color:blue Count
<span style="color:blue For Line = 0 <span style="color:blue To RichTextBox1.Lines.<span style="color:blue Count - 1
RichTextBox1.<span style="color:blue Select(RichTextBox1.GetFirstCharIndexFromLine(Line), RichTextBox1.Lines(Line).Length)
RichTextBox1.<span style="color:blue Select()
SelectedDocument = RichTextBox1.SelectedText
<span style="color:blue If RichTextBox1.SelectionBackColor = Color.Aqua <span style="color:blue Then
psi.FileName = SelectedDocument
Process.Start(psi)
<span style="color:blue End <span style="color:blue If
<span style="color:blue Next
RichTextBox3.Text = <span style="color:#a31515 "Files where printed!"
CaseStatus.SetValue(1, CaseStatusID)
CaseStatusToString.CaseStatusToString()
<span style="color:blue If Edit = 0 <span style="color:blue And Button1.Text = <span style="color:#a31515 "Archive - Print" <span style="color:blue Then
MainForm.PictureBox17.BackgroundImage = <span style="color:blue My.Resources.accept_icon
MainForm.Button13.Enabled = <span style="color:blue False
<span style="color:blue End <span style="color:blue If
Button1.Enabled = <span style="color:blue False
Button1.Text = <span style="color:#a31515 "Print"
<span style="color:blue End <span style="color:blue Sub
[/code]
<br/>
<img src="http://social.microsoft.com/Forums/getfile/49640/" alt=" <br/>
<br/>
View the full article
I am trying to print ONLY specific pages (e.g only the first page) from some files but I can not get it work. Can anyone help?
Below is my code:
<div style="color:black; background-color:white
<pre><span style="color:blue Private <span style="color:blue Sub Button1_Click(<span style="color:blue ByVal sender <span style="color:blue As System.Object, <span style="color:blue ByVal e <span style="color:blue As System.EventArgs) <span style="color:blue Handles Button1.Click
<span style="color:blue Dim psi <span style="color:blue As <span style="color:blue New ProcessStartInfo
<span style="color:blue Dim Line <span style="color:blue As <span style="color:blue Integer
<span style="color:blue Dim SelectedDocument <span style="color:blue As <span style="color:blue String
psi.UseShellExecute = <span style="color:blue True
psi.Verb = <span style="color:#a31515 "printto"
psi.WindowStyle = ProcessWindowStyle.Hidden
PrintDialog1.AllowSelection = <span style="color:blue True
PrintDialog1.AllowSomePages = <span style="color:blue True
PrintDialog1.AllowCurrentPage = <span style="color:blue True
PrintDialog1.ShowDialog()
psi.Arguments = PrintDialog1.PrinterSettings.PrinterName.ToString()
Line = Richtextbox2.Lines.<span style="color:blue Count
<span style="color:blue For Line = 0 <span style="color:blue To Richtextbox2.Lines.<span style="color:blue Count - 1
Richtextbox2.<span style="color:blue Select(Richtextbox2.GetFirstCharIndexFromLine(Line), Richtextbox2.Lines(Line).Length)
Richtextbox2.<span style="color:blue Select()
SelectedDocument = Richtextbox2.SelectedText
<span style="color:blue If Richtextbox2.SelectionBackColor = Color.Aqua <span style="color:blue Then
psi.FileName = SelectedDocument
Process.Start(psi)
<span style="color:blue End <span style="color:blue If
<span style="color:blue Next
Line = RichTextBox1.Lines.<span style="color:blue Count
<span style="color:blue For Line = 0 <span style="color:blue To RichTextBox1.Lines.<span style="color:blue Count - 1
RichTextBox1.<span style="color:blue Select(RichTextBox1.GetFirstCharIndexFromLine(Line), RichTextBox1.Lines(Line).Length)
RichTextBox1.<span style="color:blue Select()
SelectedDocument = RichTextBox1.SelectedText
<span style="color:blue If RichTextBox1.SelectionBackColor = Color.Aqua <span style="color:blue Then
psi.FileName = SelectedDocument
Process.Start(psi)
<span style="color:blue End <span style="color:blue If
<span style="color:blue Next
RichTextBox3.Text = <span style="color:#a31515 "Files where printed!"
CaseStatus.SetValue(1, CaseStatusID)
CaseStatusToString.CaseStatusToString()
<span style="color:blue If Edit = 0 <span style="color:blue And Button1.Text = <span style="color:#a31515 "Archive - Print" <span style="color:blue Then
MainForm.PictureBox17.BackgroundImage = <span style="color:blue My.Resources.accept_icon
MainForm.Button13.Enabled = <span style="color:blue False
<span style="color:blue End <span style="color:blue If
Button1.Enabled = <span style="color:blue False
Button1.Text = <span style="color:#a31515 "Print"
<span style="color:blue End <span style="color:blue Sub
[/code]
<br/>
<img src="http://social.microsoft.com/Forums/getfile/49640/" alt=" <br/>
<br/>
View the full article