Click here to Skip to main content
15,884,054 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I'm trying to remove the margins from the print preview, or change it to 1px. But it just doesn't change.

What I have tried:

public void Printing()
        {
            PrintDocument pd = new PrintDocument();
            pd.PrintPage += new PrintPageEventHandler(printDocument1_PrintPage);
            Margins margins = new Margins(1, 1, 1, 1);
            printDocument1.DefaultPageSettings.Margins = margins;
        }
Posted
Updated 1-Jun-18 0:47am

1 solution

You create a print document:
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(printDocument1_PrintPage);
Then you set the margins for a totally different one:
Margins margins = new Margins(1, 1, 1, 1);
printDocument1.DefaultPageSettings.Margins = margins;
 
Share this answer
 

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