Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. landscpae printing

landscpae printing

Scheduled Pinned Locked Moved C#
questionhelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sianatia
    wrote on last edited by
    #1

    Hi there I have a major problem with ladscape printing. when I print my documnet by PrintDocument on portrait paper it works well and every ponit prints in its own location but when I want to print in landscape all the positionings get changed in a way that some points get printed out of the paper bounds. What is my mistake in landscape printing? thanks.

    G 1 Reply Last reply
    0
    • S sianatia

      Hi there I have a major problem with ladscape printing. when I print my documnet by PrintDocument on portrait paper it works well and every ponit prints in its own location but when I want to print in landscape all the positionings get changed in a way that some points get printed out of the paper bounds. What is my mistake in landscape printing? thanks.

      G Offline
      G Offline
      Gareth H
      wrote on last edited by
      #2

      UAU, You'll need to show some code before anyone can tell you wants wrong. Regards, Gareth.

      S 1 Reply Last reply
      0
      • G Gareth H

        UAU, You'll need to show some code before anyone can tell you wants wrong. Regards, Gareth.

        S Offline
        S Offline
        sianatia
        wrote on last edited by
        #3

        hi there here is some code for more: using System; using System.IO; using System.Diagnostics; using System.Data.SqlClient; using System.Drawing; namespace test { public class Class1 { public static void Main() { System.Drawing.Printing.PrintDocument doc=new System.Drawing.Printing.PrintDocument(); doc.QueryPageSettings +=new System.Drawing.Printing.QueryPageSettingsEventHandler(doc_QueryPageSettings); doc.PrintPage +=new System.Drawing.Printing.PrintPageEventHandler(doc_PrintPage); doc.Print(); } private static void doc_QueryPageSettings(object sender, System.Drawing.Printing.QueryPageSettingsEventArgs e) { e.PageSettings=new System.Drawing.Printing.PageSettings(new System.Drawing.Printing.PrinterSettings()); e.PageSettings.PaperSize =new System.Drawing.Printing.PaperSize("Custom Size",8230,4330); e.PageSettings.Landscape=true; e.PageSettings.Margins.Left=e.PageSettings.Margins.Left= e.PageSettings.Margins.Left=e.PageSettings.Margins.Left=0; } private static void doc_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { e.Graphics.PageUnit=System.Drawing.GraphicsUnit.Millimeter; Font fnt=new Font("Tahoma",14,FontStyle.Bold); StringFormat sf=new StringFormat(StringFormatFlags.DirectionRightToLeft); sf.LineAlignment=StringAlignment.Near; sf.Alignment=StringAlignment.Near; Rectangle rec=new Rectangle(113,12,83,17); e.Graphics.DrawString("Some Text Goes here",fnt,Brushes.Black,rec,sf); } } } when I print using this code in portrait the text excatly prints in the locataion 83:17 but in landscape no test presents. Note that I use my own paper size.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups