Click here to Skip to main content
15,890,579 members
Home / Discussions / C#
   

C#

 
QuestionHow to send redraw message to background windows Pin
manchukuo2-Nov-10 8:30
manchukuo2-Nov-10 8:30 
AnswerRe: How to send redraw message to background windows Pin
kevinnicol2-Nov-10 9:00
kevinnicol2-Nov-10 9:00 
AnswerRe: How to send redraw message to background windows Pin
Luc Pattyn2-Nov-10 9:34
sitebuilderLuc Pattyn2-Nov-10 9:34 
QuestionPrint a file on printer Pin
abbd2-Nov-10 7:31
abbd2-Nov-10 7:31 
AnswerRe: Print a file on printer Pin
OriginalGriff2-Nov-10 7:52
mveOriginalGriff2-Nov-10 7:52 
QuestionRe: Print a file on printer Pin
abbd2-Nov-10 8:01
abbd2-Nov-10 8:01 
AnswerRe: Print a file on printer Pin
Martijn Boeker2-Nov-10 11:04
Martijn Boeker2-Nov-10 11:04 
GeneralRe: Print a file on printer Pin
abbd3-Nov-10 0:48
abbd3-Nov-10 0:48 
Hello,

I try for :

Unfortunatly, he open my pdf then print a false caratcters
I would to print a pdf directely withou open it.
Please help me to resolve this great problem.
Thank you verry mutch.


try
                {
                    streamToPrint = new StreamReader(file.FullName);
                    try
                    {
                        printFont = new Font("Arial", 10);
                        PrintDocument pd = new PrintDocument();
                        pd.PrintPage += new PrintPageEventHandler(pd_PrintPage);
                        pd.PrinterSettings.PrinterName = "PDFCreator";                    

                        pd.Print();
                        currentLog.AddLog("Printing : ", string.Format("fichier : {0}", file));
                        file.Delete();
                    }
                    finally
                    {
                        streamToPrint.Close();
                    }
                }
                catch (Exception ex)
                {
                }


public static void pd_PrintPage(object sender, PrintPageEventArgs ev)
        {
            float linesPerPage = 0;
            float yPos = 0;
            int count = 0;
            float leftMargin = ev.MarginBounds.Left;
            float topMargin = ev.MarginBounds.Top;
            string line = null;

            linesPerPage = ev.MarginBounds.Height / printFont.GetHeight(ev.Graphics);

            while (count < linesPerPage && ((line = streamToPrint.ReadLine()) != null))
            {   yPos = topMargin + (count * printFont.GetHeight(ev.Graphics));
                ev.Graphics.DrawString(line, printFont, Brushes.Black, leftMargin, yPos, new StringFormat());
                count++;
            }

            if (line != null)
            ev.HasMorePages = true;
            else
            ev.HasMorePages = false;
        }

AnswerRe: Print a file on printer Pin
Henry Minute2-Nov-10 10:01
Henry Minute2-Nov-10 10:01 
QuestionHow to run program at windows startup with administrator rights (on VISTA and Windows 7 )? Pin
Aseem Sharma2-Nov-10 6:48
Aseem Sharma2-Nov-10 6:48 
AnswerRe: How to run program at windows startup with administrator rights (on VISTA and Windows 7 )? Pin
Eddy Vluggen2-Nov-10 9:17
professionalEddy Vluggen2-Nov-10 9:17 
GeneralRe: How to run program at windows startup with administrator rights (on VISTA and Windows 7 )? Pin
PIEBALDconsult2-Nov-10 18:16
mvePIEBALDconsult2-Nov-10 18:16 
AnswerRe: How to run program at windows startup with administrator rights (on VISTA and Windows 7 )? Pin
Dave Kreskowiak2-Nov-10 14:01
mveDave Kreskowiak2-Nov-10 14:01 
GeneralRe: How to run program at windows startup with administrator rights (on VISTA and Windows 7 )? Pin
Aseem Sharma4-Nov-10 2:49
Aseem Sharma4-Nov-10 2:49 
AnswerRe: How to run program at windows startup with administrator rights (on VISTA and Windows 7 )? Pin
PIEBALDconsult2-Nov-10 18:19
mvePIEBALDconsult2-Nov-10 18:19 
GeneralRe: How to run program at windows startup with administrator rights (on VISTA and Windows 7 )? Pin
Aseem Sharma4-Nov-10 3:35
Aseem Sharma4-Nov-10 3:35 
Questionhow to detact terminal emulation Pin
bigjoe11a2-Nov-10 5:52
bigjoe11a2-Nov-10 5:52 
AnswerRe: how to detact terminal emulation Pin
PIEBALDconsult2-Nov-10 15:13
mvePIEBALDconsult2-Nov-10 15:13 
QuestionLoad assembly dynamically and call methods Pin
marca2922-Nov-10 4:14
marca2922-Nov-10 4:14 
AnswerRe: Load assembly dynamically and call methods Pin
Luc Pattyn2-Nov-10 4:20
sitebuilderLuc Pattyn2-Nov-10 4:20 
AnswerRe: Load assembly dynamically and call methods Pin
souidi abderrahman3-Nov-10 0:30
souidi abderrahman3-Nov-10 0:30 
QuestionChnaging connectionString and reloading it Pin
mrkeivan2-Nov-10 4:06
mrkeivan2-Nov-10 4:06 
AnswerRe: Chnaging connectionString and reloading it Pin
thatraja2-Nov-10 4:25
professionalthatraja2-Nov-10 4:25 
GeneralRe: Chnaging connectionString and reloading it Pin
mrkeivan2-Nov-10 4:34
mrkeivan2-Nov-10 4:34 
GeneralRe: Chnaging connectionString and reloading it Pin
jschell2-Nov-10 8:28
jschell2-Nov-10 8:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.