Results 1 to 4 of 4

Thread: C# PrintDocument printing problem

  1. #1
    Join Date
    Jul 2010
    Posts
    25

    C# PrintDocument printing problem

    I am developing an application to print using the PrintDocument class, the problem is that as the same print through Graphics, when I design what I want to print and transfer to another PC with another resolution, move the margins and the picture is not the same size. So if I change the printer for another with different resolution should happen the same. There any way to prevent this from happening? I am tried my best but was not victorious . So thought to take some help from you members. As the movement could get its own printing device is connected?

  2. #2
    Join Date
    Oct 2008
    Posts
    76

    Re: C# PrintDocument printing problem

    Sure we're talking about screen resolution? It sounds to me that the problems were with the resolutions of the printers, but obviously I can be wrong. The tests do the same printer? Many times it happens that tests do with the screen as the default printer using the PDF Creator, and when you change the DPI of the screen, the picture for example does not leave the same size, so I guess if you change your printer or the same will happen PC.

  3. #3
    Join Date
    Jul 2010
    Posts
    26

    Re: C# PrintDocument printing problem

    Even I am facing some same kind of problem. I have a window application developed in C # (VS2005) in which volume data display and print control. My problem is concentrated in the whole method:
    Code:
    private void printDocument1_PrintPage (object sender, System.Drawing.Printing.PrintPageEventArgs e) 
    { 
    .... 
    }
    After running, it automatically runs again and whether I am printing more than one page (using the property HasMorePages = true and some counter defined as class variable) it creates problems because in the second pass (the "automatic") My counter is changed and therefore the execution flow behaves differently. What has me more puzzled is why? the second execution of the method,
    Code:
    private void printDocument1_PrintPage (object sender, System.Drawing.Printing.PrintPageEventArgs e) 
    { 
    }
    for only then will send the print order. Maybe I have something set wrong, if I can help you appreciate a lot because I bring this problem a few days ago and I have like crazy.

  4. #4
    Join Date
    Jul 2010
    Posts
    32

    Re: C# PrintDocument printing problem

    I look across the same problem and not cycled you I can not explain why it happens because I did the same thing you thought was right and nothing ever went wrong I had something similar to yours and watch this code that I'm going to spend my problems you can resolve what happened so it can not find the link as the link that I found so leave the code because I use something similar on StringBuilder underside of a string and I also add a Rectangle for Print manipulate space but what is important and what you need is in this part focus:
    Code:
    Font font = new Font ("Arial", 12); 
    CharactersUsed int = 0; 
    LinesUsed int = 0; 
    Rectangle area = new Rectangle (e.MarginBounds.X, e.MarginBounds.Y + 100, e.MarginBounds.Width, e.MarginBounds.Height - 100); 
    AddTitle (e, "Title", Space); 
    e.Graphics.MeasureString (Text.ToString (), Font, Space.Size, StringFormat.GenericTypographic, CharactersUsed out, out LinesUsed) 
    e.Graphics.DrawString (Text.ToString (), Font, Brushes.Black, Space, StringFormat.GenericTypographic) 
    Texto.Remove text = (0, CharactersUsed) 
    e.HasMorePages = (Text.Length> 0); 
    AddFooter (e, Space, PageCounter, "dd / mm / yy", "00:00"); 
    PageCounter + +;
    This is correct, it works perfectly, however as I do not understand you because if you declare a global variable which increases to stop the event PrintDocument and e.HasMorePage = false, because you can not. I hope someone can say that happens, just as you commented the code that i put you up and running as I achieved this after a lot but I still do not understand 100% the performance of HasMorePages.

Similar Threads

  1. Problem printing calendar using outlook
    By Measurer in forum Windows Software
    Replies: 5
    Last Post: 08-03-2010, 04:03 PM
  2. Page Border problem while printing
    By Arlo in forum Windows Software
    Replies: 3
    Last Post: 25-06-2009, 11:59 AM
  3. printing problem in network
    By Harding in forum Networking & Security
    Replies: 3
    Last Post: 05-01-2009, 08:48 PM
  4. printing problem
    By WhiteEagle in forum Hardware Peripherals
    Replies: 3
    Last Post: 05-01-2009, 11:01 AM
  5. Printing Problem with Vista
    By Seraphim in forum Portable Devices
    Replies: 2
    Last Post: 16-09-2008, 12:53 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,646,332.65064 seconds with 16 queries