Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- converter = New HtmlToPdf()
- Dim file As String = "C:TEMPDocument5.pdf"
- converter.Options.PdfPageSize = PdfPageSize.A4
- converter.Options.PdfPageOrientation = PdfPageOrientation.Portrait
- converter.Options.MarginTop = 20
- converter.Options.MarginBottom = 20
- converter.Options.MarginLeft = 10
- converter.Options.MarginRight = 10
- converter.Options.DisplayFooter = True
- Dim doc As PdfDocument = converter.ConvertHtmlString(htmlString)
- converter.Footer.TotalPagesOffset =2
- converter.Footer.FirstPageNumber = 2
- doc.Save(file)
- ' close pdf document
- doc.Close()
- converter.Footer.TotalPagesOffset =2
- converter.Footer.FirstPageNumber = 2
- for (int x = 0; x < PDF.Pages.Count; x++) {
- if (x > 0 && x != PDF.Pages.Count - 1) { // will not number first/last page
- PdfPage page = PDF.Pages[x];
- PdfTemplate customFooter = PDF.AddTemplate(page.PageSize.Width, 33f);
- page.DisplayFooter = true;
- PdfHtmlElement customHtml = new PdfHtmlElement(domain + "/template/_pagenumber?pageNum=" + x.ToString() + "&totalPages=" + PDF.Pages.Count.ToString());
- customFooter.Add(customHtml);
- page.CustomFooter = customFooter;
- }
- }
- <div style="margin-right:48px;margin-left:48px;height:46px;position:relative;top:-4px;z-index:999;">
- <div class="row">
- <div class="col-xs-6">
- <small>Company info goes here</small>
- </div>
- <div class="col-xs-6 text-right">
- <small><strong>Page @(Request.QueryString["pageNum"]) of @(Request.QueryString["totalPages"])</strong></small>
- </div>
- </div>
- </div>
Add Comment
Please, Sign In to add comment