Click here to Skip to main content
15,888,020 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
from many years ago it is same problem

we need how to set print able area to the printer

margin bound it is different in several printers devices between 10 to 20 pixel

are we get answer?

What I have tried:

I tested more code for set printable area to preview and print to printer

but I did not get margin bounds in left and Top for Hard margin
Posted
Updated 28-May-23 12:01pm

You can get the printable area via the PageSettings.PrintableArea Property (System.Drawing.Printing) | Microsoft Docs[^], but you can't set it - it's read only.

Think about it: you can't tell the printer where it's printable area is because the hardware paper handling system dictates where it printer can and can't put ink: if the hardware prevents the head reaching less than 2cm from the paper edge then you can't tell it to print 1cm from the edge no matter how much you want to!

The printable area varies from printer to printer, and cannot be changed by software.
 
Share this answer
 
try this please

e.Graphics.TranslateTransform(-e.PageSettings.HardMarginX , -e.PageSettings.HardMarginY);
 
Share this answer
 
Hello Mr. Griff

Thank you for your answer .

crystal report or DevExpress report it was build by System.Drawing and

System.Drawing.Printing, you can see the Margine Bounds it is Constant when you want print

to printer and for any printer devices
 
Share this answer
 
Comments
Richard Deeming 12-Apr-21 6:47am    
If you want to reply to a solution, click the "Have a Question or Comment?" button under that solution and post a comment.

Do not post your comment as a new "solution".
Member 12949272 12-Apr-21 13:26pm    
thank you Richard

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900