Ejemplo n.º 1
0
        public Dictionary <string, string> JsonConverterstring(jsonObjects results)
        {
            Dictionary <string, object> resultObjects = new Dictionary <string, object>();

            resultObjects = results.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public)
                            .ToDictionary(prop => prop.Name, prop => prop.GetValue(results, null));
            var emptyObjects = (from kv in resultObjects
                                where kv.Value != null
                                select kv).ToDictionary(kv => kv.Key, kv => kv.Value);
            Dictionary <string, string> jsonResult = emptyObjects.ToDictionary(k => k.Key, k => k.Value.ToString());

            return(jsonResult);
        }
Ejemplo n.º 2
0
        public JsonResult Download(jsonObjects result)
        {
            PdfViewerHelper helper     = new PdfViewerHelper();
            var             jsonResult = JsonConverterstring(result);

            if (jsonResult.ContainsKey("savedFields"))
            {
                var values = jsonResult["savedFields"];
                Dictionary <string, string> data = JsonConvert.DeserializeObject <Dictionary <string, string> >(values);
                jsonResult = data;
            }
            return(Json(helper.GetDocumentData(jsonResult)));
        }
Ejemplo n.º 3
0
        public ActionResult FileUpload(jsonObjects result)
        {
            PdfViewerHelper helper     = new PdfViewerHelper();
            var             jsonResult = JsonConverterstring(result);

            if (jsonResult.ContainsKey("uploadedFile"))
            {
                var          fileurl   = jsonResult["uploadedFile"];
                byte[]       byteArray = Convert.FromBase64String(fileurl);
                MemoryStream stream    = new MemoryStream(byteArray);
                helper.Load(stream);
            }
            return(Content(JsonConvert.SerializeObject(helper.ProcessPdf(jsonResult))));
        }
Ejemplo n.º 4
0
        public ActionResult Load(jsonObjects results)
        {
            PdfViewerHelper helper     = new PdfViewerHelper();
            var             jsonResult = JsonConverterstring(results);

            //load the multiple document from client side
            if (jsonResult.ContainsKey("newFileName"))
            {
                var name    = jsonResult["newFileName"];
                var pdfName = name.ToString() + ".pdf";
                helper.Load(Helper.GetFilePath("" + pdfName));
            }
            else
            {
                //Initially load the PDF document from the data folder.
                if (jsonResult.ContainsKey("isInitialLoading"))
                {
                    helper.Load(Helper.GetFilePath("FormFillingDocument.pdf"));
                }
            }
            return(Content(JsonConvert.SerializeObject(helper.ProcessPdf(jsonResult))));
        }