Thursday, 10 November 2022

Make PDF from hyperlink | ASP.NET C#


 This post will help you to create a PDF file from a URL in ASP.Net C#. Follow the steps given below. We will save a PDF file on the server then after viewing the PDF file, the file will be deleted. 

Step 1 : 

Download Select.HtmlToPdf.NetCore package from NuGet. 

Goto Tools Menu>Nuget Package Manager > Manage Nuget Package for Solution

Step 2 : 

 
 Create a Button and call the javascript function, which will create a PDF file from the given URL. The passing argument is URL of the page. Which will be converted into PDF file on the server at the given path. Then you can download the file.

<input type="button" value="Get PDF" onclick="createPDF('https://girfa.co.in/')" />

Step 3 


Javascript Code

function createPDF(pageurl)
 {

         $.ajax({

                url: '/Common/htmltopdf/',
                async: true,
                dataType: "json",
                type: "GET",
                contentType: 'application/json; charset=utf-8',       

                data: { url: pageurl},

                success: function (data) {              

                    DelPDF('/upload/print/' + $.trim(invid) + '.pdf');                   

                    window.location.href = '/upload/print/' + $.trim(invid) + '.pdf';                          

                }

            });          

        }

 

function DelPDF(path) 
{          

            $.ajax({

                url: '/Common/DeleteCommonFile?path=' + path,

                type: "POST",

                contentType: false, // Not to set any content header

                processData: false, // Not to process data           

                 success: function (result) {

                    //Update Extension
                    if (result.sMessage == "1")
                    {
   

                    }
                    else
                        alert(result.sMessage);

                },
                error: function (abc) {
                    alert(abc.statusText); 

                }

            });

}

Step 4

Controller C# code

public JsonResult htmltopdf(string url,string inv)

        {

            // instantiate a html to pdf converter object

            HtmlToPdf converter = new HtmlToPdf(); 

            // create a new pdf document converting an url
            PdfDocument doc = converter.ConvertUrl(url); 

            // save pdf document

            doc.Save(Server.MapPath("~/upload/print/" + inv + ".pdf")); 

            // close pdf document

            doc.Close();

            return Json(new { sMessage = "11"}, JsonRequestBehavior.AllowGet); 

        }

 

[HttpPost]

        public JsonResult DeleteCommonFile(string path)
        {

            try
            {

                string filename = Server.MapPath(path);
                if (System.IO.File.Exists(filename))
                {

                    System.IO.File.Delete(filename);

                } 

                return Json(new { sMessage = "1", JsonRequestBehavior.AllowGet });

            }

            catch (Exception ex)
            {

                return Json(new { sMessage = ex.Message, JsonRequestBehavior.AllowGet });

            }

        }


Wednesday, 12 October 2022

E-Commerce Website IGNOU Synopsis



Download E-Commerce IGNO Synopsis

इस पेज पर आप इ-कॉमर्स टॉपिक पर इग्नू के लिए सिनोप्सिस डाउनलोड क्र सकते  है।  इ-कॉमर्स प्रोजेक्ट सिनोप्सिस इग्नू के द्वारा दिए गए निर्देशों के अनुरूप बनाया गया है।  ये प्रोजेक्ट सिनोप्सिस इग्नू में उपयोग किया जा सकता है , क्योकि इग्नू द्वारा दिए गए सिनोप्सिस सैंपल  के सारे  पॉइंट को कवर किया गया है। 


On this page, you can download Synopsis for IGNOU on the E-commerce topic. The e-commerce project synopsis is designed as per the instructions given by IGNOU. This project synopsis can be used in IGNOU, as all the points of the synopsis sample given by IGNOU are covered.

Saturday, 8 October 2022

IGNOU Synopsis Computer Science

Get MCA project synopsis for IGNOU . All Synopsis on this page are made as per the IGNOU guidline . All points are covered. PDF and editable word both version are available . PDF is free and editable word version is paid and can be modified if required. List synopis on different topics are given below.

IGNOU  Project Guidline


Download IGNOU MCA/BCA Synopsis

 Next Synopsis

Wednesday, 21 September 2022

Delete Record Entity Framework C# | ASP.Net MVC

dbConnection db = new dbConnection();

db.WebMsg.Remove(db.WebMsg.Single(x => x.ID == 123));

 Next Topic