Skip to main content

Posts

Showing posts with the label mvc 5

What beforFilter(), beforeRender() and afterFilter() functions do in Controller?

What beforFilter(), beforeRender() and afterFilter() functions do in Controller? beforeFilter () -This function is used to run before every action in the controller. Most of the programmer used to check valid session, user role and permissions. beforeRender () - This function is used to called after controller action logic and before the view is rendered. afterFilter () - This function is used to called after every controller action and after rendering is competed. It is the last controller method to run.

Create and Download PDF using itextsharp MVC 5

How To Create Download PDF using itextsharp MVC 5? //Create and Download PDF using itextsharp MVC 5 //how to convert html to pdf with image tags using itextsharp?   private static byte [] ExportHTMLToPDF ( string fileName, StringBuilder sb)  {     string imagepath = "http://localhost:53865//Images/pdf-logo.png" ;     FileStream obj ;     fileName = Helper . CreateDirectory ( Constant . UploadedFileFolder , fileName );     obj = new FileStream ( fileName , FileMode . Create );     StringReader sr = new StringReader ( sb . ToString ());     Document pdfDoc = new Document ( PageSize . LETTER , 70 , 55 , 40 , 25 );     try     {         PdfWriter writer = PdfWriter . GetInstance ( pdfDoc , obj );         HTMLWorker htmlparser = new HTML...