Skip to content

Instantly share code, notes, and snippets.

@manuelnelson
Created December 3, 2012 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manuelnelson/4195771 to your computer and use it in GitHub Desktop.
Save manuelnelson/4195771 to your computer and use it in GitHub Desktop.
Pechkin set content spacing
public ActionResult PrintForm(string html)
{
var globalConfig = new GlobalConfig();
globalConfig.SetPaperSize(PaperKind.Letter);
var margins = new Margins(100, 100, 100, 100);
globalConfig.SetMargins(margins);
var synchronizedPechkin = new SynchronizedPechkin(globalConfig);
var config = new ObjectConfig();
config.SetAllowLocalContent(true)
.SetPrintBackground(true);
config.Header.SetFont(new Font("Times New Roman", 9F, FontStyle.Underline));
//The following line has no effect!
config.Header.SetContentSpacing(20.0);
config.Header.SetLeftText("Left Header text");
config.Header.SetRightText("Right Header Text");
config.Footer.SetFont(new Font("Times New Roman", 12F, FontStyle.Regular));
config.Footer.SetTexts("Footer text", @"[page] of [topage]", "Right footer text");
var pdfBuf = synchronizedPechkin.Convert(config, html);
return File(pdfBuf, "application/pdf", "form.pdf");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment