Implemented the first version of the report settings to help compensate for the screen resolution dependence the PDF engines seem to have.

This commit is contained in:
2017-05-10 02:05:51 -05:00
parent 4c6b79aea1
commit a569a21294
12 changed files with 1146 additions and 10 deletions
@@ -19,7 +19,12 @@ namespace AdvertsingProfitControl
var stringWriter = new StringWriter();
var writer = new HtmlTextWriter(stringWriter);
BuildReportFrontPage(date, ref writer);
var frontPage = new SimplePechkin(new GlobalConfig().SetPaperOrientation(true).SetPaperSize(PaperKind.A4)).Convert(stringWriter.ToString());
if (!Enum.TryParse(Properties.Settings.Default.ReportPaperKind, out PaperKind paperKind))
{
//TODO: Report this error to the user.
paperKind = PaperKind.A4;
}
var frontPage = new SimplePechkin(new GlobalConfig().SetPaperOrientation(true).SetPaperSize(paperKind)).Convert(stringWriter.ToString());
//
using (var fs = new FileStream(GlobalClasses.LogFilePath + "Front.pdf", FileMode.Create, FileAccess.Write))
{
@@ -46,12 +51,12 @@ namespace AdvertsingProfitControl
writer.AddAttribute(HtmlTextWriterAttribute.Type, "text/css");
//Set the global style for the data cells.
writer.RenderBeginTag(HtmlTextWriterTag.Style);
writer.Write("td{margins:0; padding:2px; border:1px solid black; font-size:14px; text-align:center; vertical-align:bottom}");
writer.Write("td{margins:0; padding:2px; border:1px solid black; font-size:" + Properties.Settings.Default.ApcFontSize + "; text-align:center; vertical-align:bottom}");
writer.RenderEndTag();// end style
writer.RenderEndTag(); // end Head
//writer.AddAttribute(HtmlTextWriterAttribute.Style, "width:11in; height:8in");
writer.RenderBeginTag(HtmlTextWriterTag.Body);
writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:none; border-collapse: collapse; margin-top:1in; width:100%; height:100%"); //style for the table
writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:none; border-collapse: collapse; margin-top:1in; " + Properties.Settings.Default.ApcReportWidth + "; " + Properties.Settings.Default.ApcReportHeight); //style for the table
writer.RenderBeginTag(HtmlTextWriterTag.Table);
//Begin rendering the top rows, the form name, store, department and date fields.
writer.RenderBeginTag(HtmlTextWriterTag.Tr);//begin first row