Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
I want to set page range while printing a document and for that code i am using is
if (txt_Browse.Text != "")
{
    streamToPrint = new StreamReader(txt_Browse.Text);
    if (range.Checked)
    {
        if (Startrange.Text != "" && Endrange.Text != "")
        {
            // PrintDialog PrintDialog1 = new PrintDialog();
            //PrintDialog1.user = true;
            printDocument.PrinterSettings.PrinterName = cmb_printername.Text;
 
            printDocument.PrinterSettings.FromPage = int.Parse(Startrange.Text);
            printDocument.PrinterSettings.ToPage = int.Parse(Endrange.Text);
            printDocument.DocumentName = txt_Browse.Text;
            printDocument.Print();
        }
But its not working.Need help.
Posted 23-Jan-13 20:01pm
Edited 23-Jan-13 20:44pm
15K
v3
Comments
Sanjeev Alamuri at 24-Jan-13 2:10am
   
please be clear about ur question. whether it is Windows or Web. and paste some more code.
for windows, check here,
http://stackoverflow.com/questions/7461518/page-range-problem-at-printing-a-document
http://www.c-sharpcorner.com/uploadfile/mahesh/printdialog-in-C-Sharp/
lukeer at 24-Jan-13 2:47am
   
In what method does you posted code belong?
To what object des it belong?
 
What's the exact error message you're getting?
What line of code does the error message point to?
Sergey Alexandrovich Kryukov at 16-Apr-13 13:22pm
   
Please stop posting non-answers as "solution". It can give you abuse reports which eventually may lead to cancellation of your CodeProject membership. And the fact you even self-accepted some formally is just outrageous, a sure way for a ban. I hope you won't do it after this warning.
 
Comment on any posts, reply to available comments, or use "Improve question" (above).
Also, keep in mind that members only get notifications on the post sent in reply to there posts.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 676
1 OriginalGriff 385
2 CPallini 240
3 PIEBALDconsult 150
4 Magic Wonder 131
0 OriginalGriff 5,835
1 Sergey Alexandrovich Kryukov 5,198
2 CPallini 4,740
3 George Jonsson 3,167
4 Gihan Liyanage 2,470


Advertise | Privacy | Mobile
Web04 | 2.8.140916.1 | Last Updated 24 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100