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
  1. Home
  2. General Programming
  3. C#
  4. PrintDocument margins ignored

PrintDocument margins ignored

Scheduled Pinned Locked Moved C#
question
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.
  • E Offline
    E Offline
    Eli Nurman
    wrote on last edited by
    #1

    Hi, i am developing an app that prints on label sheets, this requires setting the data in the OnPrintPage from pixel 0,0. When i draw the document on the OnPrintPage in all looks ok with a PrintPreviewControl, but when i actually print the page with a printer it start printing with a margin, how do i get the printer to print the exact same as the PrintDocument and if the printer is not capable to print the margins then he should just ignore these pixels?! does it have with any margin settings? PageBounds?

    D 1 Reply Last reply
    0
    • E Eli Nurman

      Hi, i am developing an app that prints on label sheets, this requires setting the data in the OnPrintPage from pixel 0,0. When i draw the document on the OnPrintPage in all looks ok with a PrintPreviewControl, but when i actually print the page with a printer it start printing with a margin, how do i get the printer to print the exact same as the PrintDocument and if the printer is not capable to print the margins then he should just ignore these pixels?! does it have with any margin settings? PageBounds?

      D Offline
      D Offline
      Dr Walt Fair PE
      wrote on last edited by
      #2

      I've run into similar problems and honestly haven't found a good way around them. You see, in my case, people can change the printer selection and so my program doesn't really know what margins a printer may have, etc. The best I can tell, you can specify margins, etc, but the system doesn't enforce them automatically. At least with the lower level functions, it's up to your code to enforce the margins. My solution kludge was to compute the page margins in pixels for each device and then blank the margin rectangles after drawing and before printing each page. Don't forget that the PixelsPerInch numbers can be pretty strange for different devices. Perhaps someone else has a better solution.

      CQ de W5ALT

      Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software

      E 1 Reply Last reply
      0
      • D Dr Walt Fair PE

        I've run into similar problems and honestly haven't found a good way around them. You see, in my case, people can change the printer selection and so my program doesn't really know what margins a printer may have, etc. The best I can tell, you can specify margins, etc, but the system doesn't enforce them automatically. At least with the lower level functions, it's up to your code to enforce the margins. My solution kludge was to compute the page margins in pixels for each device and then blank the margin rectangles after drawing and before printing each page. Don't forget that the PixelsPerInch numbers can be pretty strange for different devices. Perhaps someone else has a better solution.

        CQ de W5ALT

        Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software

        E Offline
        E Offline
        Eli Nurman
        wrote on last edited by
        #3

        Thanks for the reply. The strange thing is that when i print to a PDF file with BullZip and from there to my printer he will ignore the margins just like i want. and if BullZip can so can we! BUT HOW?

        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