Results 1 to 2 of 2

Thread: PrintPreview looks different then printed document

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2013
    Posts
    1

    PrintPreview looks different then printed document

    Hi,

    i am just learning how to print in VB.NET and using the PrintPreview and PrintDocument.

    when drawing a rect over the whole printable-area it is printed correctly over the whole area, but in the preview it appears to be shifted in the upper left corner

    infos:

    PrintDocument1.DefaultPageSettings.Bounds.Left = 0
    PrintDocument1.DefaultPageSettings.Bounds.Top = 0
    PrintDocument1.DefaultPageSettings.Bounds.Right = 827
    PrintDocument1.DefaultPageSettings.Bounds.Bottom = 1169
    PrintDocument1.DefaultPageSettings.Bounds.Width = 827
    PrintDocument1.DefaultPageSettings.Bounds.Height = 1169

    PrintDocument1.DefaultPageSettings.Margins.Left = 0
    PrintDocument1.DefaultPageSettings.Margins.Top = 0
    PrintDocument1.DefaultPageSettings.Margins.Right = 0
    PrintDocument1.DefaultPageSettings.Margins.Bottom = 0

    PrintDocument1.DefaultPageSettings.PrintableArea.Left = 23,66667
    PrintDocument1.DefaultPageSettings.PrintableArea.Top = 16,66667
    PrintDocument1.DefaultPageSettings.PrintableArea.Right = 803
    PrintDocument1.DefaultPageSettings.PrintableArea.Bottom = 1152,5
    PrintDocument1.DefaultPageSettings.PrintableArea.Width = 779,3333
    PrintDocument1.DefaultPageSettings.PrintableArea.Height = 1135,833

    PrintDocument1.DefaultPageSettings.PaperSize.PaperName = A4
    PrintDocument1.DefaultPageSettings.PaperSize.Width = 827
    PrintDocument1.DefaultPageSettings.PaperSize.Height = 1169


    rect:

    g.DrawRectangle(Pens.Black, 0, 0, 779, 1135)

    what am i doing wrong?

    thanks

  2. #2
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: PrintPreview looks different then printed document

    The Preview shows your graphics exactly as you've drawn them with an origin of 0,0 and no margins. The actual print will be made within the printable area using it's co-ordinates so 0,0 is offset from the edge of the paper.
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width