c# - PhantomJS Body text spills into page header -
i running issue phantomjs making snapshot of c# mvc view pdf.
currently, when code runs, call phantomjs c# wrapper , points view, generated , phantomjs whatever , converts pdf file. that's fine , dandy.
however, when @ pdf file, see bit:
as can see, "feedback report table of contents" in page header. ideally, best if header have it's own space in dom , else pushed down.
here's rasterize.js file had modify:
"use strict"; var page = require('webpage').create(), system = require('system'), address, output, size, pagewidth, pageheight, fullname; if (system.args.length < 3 || system.args.length > 5) { phantom.exit(1); } else { address = system.args[1]; output = system.args[2]; fullname = system.args[3]; page.viewportsize = { width: 1140, height: 1000 }; page.papersize = { height: '11in', width: '8.5in', margin: { top: '20px', bottom: '20px', left: '10px', right: '10px' }, header: { height: '20px', contents: phantom.callback(function () { return "<div style='border-bottom: 1px solid #808080; margin-top: -10px;'>" + "<span style='color: #808080; font-size: 12px;'>virtual competency assessment - feedback report</span><br />" + "<span style='color: #808080; font-size: 12px;'>" + "john doe" + " - " + getdate() + "</span>" + "</div>"; }) }, footer: { height: '20px', contents: phantom.callback(function (pagenum, numpages) { return "<div style='text-align: center;'>" + "<span style='color: #808080; font-size: 15px; font-family: arial;'>" + "page <strong>" + pagenum + "</strong> of <strong>" + numpages + "</strong>" + "</span>" + "</div>"; }) } }; page.open(address, function (status) { if (status !== 'success') { console.log('unable load address!'); phantom.exit(1); } else { window.settimeout(function () { page.render(output); phantom.exit(); }, 200); } }); } var getdate = function () { var today = new date(); return (today.getmonth() + 1) + "/" + today.getdate() + "/" + today.getfullyear(); } any appreciated. thank time.
jason

Comments
Post a Comment