public PdfMap(AppState appState, string templateId, List <String> input, PreserveMode preserveMode, double originalWidth) { _appState = appState; _templateId = templateId; _input = input; _preserveMode = preserveMode; _originalWidth = originalWidth; }
public PdfMap(AppState appState, string templateId, List<String> input, PreserveMode preserveMode, double originalWidth) { _appState = appState; _templateId = templateId; _input = input; _preserveMode = preserveMode; _originalWidth = originalWidth; }
public void ProcessRequest(HttpContext context) { HttpResponse response = context.Response; response.Clear(); AppState appState = AppState.FromJson(context.Request.Form["state"]); string templateID = context.Request.Form["template"]; string scaleMode = context.Request.Form["scalemode"]; double originalWidth = Convert.ToDouble(context.Request.Form["width"]); // if the user entered a feet-per-inch scale, compute the pixel width of the map // for the scale given the extent width if (scaleMode == "input") { double extentWidth = appState.Extent.Width * (AppContext.AppSettings.MapUnits == "feet" ? 1 : Constants.FeetPerMeter); double scale = Convert.ToDouble(context.Request.Form["scale"]); originalWidth = extentWidth * 96 / scale; scaleMode = "scale"; } PreserveMode preserveMode = (PreserveMode)Enum.Parse(typeof(PreserveMode), scaleMode, true); // read in the user inputs List <String> input = new List <String>(); Configuration.ApplicationRow application = AppContext.GetConfiguration().Application.First(o => o.ApplicationID == appState.Application); Configuration.PrintTemplateRow template = application.GetPrintTemplates().First(o => o.TemplateID == templateID); foreach (Configuration.PrintTemplateContentRow element in template.GetPrintTemplateContentRows().Where(o => o.ContentType == "input")) { string fieldName = String.Format("input_{0}_{1}", template.TemplateID, element.SequenceNo); input.Add(context.Request.Form[fieldName]); } // produce the PDF output PdfMap pdfMap = new PdfMap(appState, templateID, input, preserveMode, originalWidth); pdfMap.Write(response); response.End(); }
protected void cmdCreate_Click(object sender, EventArgs e) { AppState appState = AppState.RestoreFrom(ViewState); double width = (double)ViewState["width"]; PreserveMode preserveMode = optPreserveScale.Checked ? PreserveMode.Scale : PreserveMode.Width; List <String> input = new List <String>(); if (ddlPrintTemplate.SelectedIndex > -1 && _inputFields.ContainsKey(ddlPrintTemplate.SelectedValue)) { foreach (int i in _inputFields[ddlPrintTemplate.SelectedValue]) { TextBox tbo = FindControl(String.Format("tboInput{0}", i)) as TextBox; input.Add(tbo.Text); } } PdfMap pdfMap = new PdfMap(appState, ddlPrintTemplate.SelectedValue, input, preserveMode, width); pdfMap.Write(Response); Response.End(); }