gmanny / Pechkin

.NET Wrapper for WkHtmlToPdf static DLL. Allows you to utilize full power of the library.
401 stars 128 forks source link

Print margins method .SetMargins() not working? #18

Closed Noodle56 closed 11 years ago

Noodle56 commented 12 years ago

Hi again,

I've set the pdf margins to zero on my GlobalConfig, but it doesn't seem to make a difference to the output. Am I doing something wrong?

    Pechkin.GlobalConfig config = new Pechkin.GlobalConfig()
        .SetPaperSize(
            kind: paperKind
            )
        .SetDocumentTitle("something")
        .SetMargins(new System.Drawing.Printing.Margins(0, 0, 0, 0))
        ;

Thanks, Ben

bUKaneer commented 11 years ago

I may be completely wrong but I'm sure I saw a comment on one of the issues talking about fluent notation being iffy (I cant find the actual post now) but try modifying your code like so just to see...

Pechkin.GlobalConfig config = new Pechkin.GlobalConfig(); config.SetPaperSize(kind: paperKind); config.SetDocumentTitle("something"); System.Drawing.Printing.Margins margins = new System.Drawing.Printing.Margins(0, 0, 0, 0) config.SetMargins(margins);

Noodle56 commented 11 years ago

Brilliant - thank you, that was the issue! Changing my code to be exactly as you wrote works perfectly. Thanks for your help!