How to genarate PDF with html+css

How to genarate PDF with html+css(folders) using Jquery or C#.
bharath kuamr ReddyDOT NET DEVELOPERAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

skijCommented:
Multiple ways to accomplish this are described and reviewed here:
http://www.codeproject.com/Questions/425227/Html-to-PDF-conversion-using-csharp
0
Prakash SamariyaIT ProfessionalCommented:
You can do that using 3rd party Tool
https://code.msdn.microsoft.com/Convert-from-HTML-to-PDF-09ce2a1d#content

Download from http://selectpdf.com/community-edition/
Add reference into your C# application

use below code
// Create object of HtmlToPdf class
HtmlToPdf converter = new HtmlToPdf(); 
 
//convert the url to pdf 
PdfDocument doc = converter.ConvertUrl(url); 
 
doc.Save(file); 
doc.Close();

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
E. BjornCommented:
Very good is the free  html to pdf library from http://www.hiqpdf.com/free-html-to-pdf-converter.aspx . You can download a sample C# project for asp.net from https://hiqpdf.codeplex.com/ . The C# code is:

    // create the HTML to PDF converter
    HtmlToPdf htmlToPdfConverter = new HtmlToPdf();
 
    // set browser width
    htmlToPdfConverter.BrowserWidth = int.Parse(textBoxBrowserWidth.Text);
 
    // set browser height if specified, otherwise use the default
    if (textBoxBrowserHeight.Text.Length > 0)
        htmlToPdfConverter.BrowserHeight = int.Parse(textBoxBrowserHeight.Text);
 
    // set HTML Load timeout
    htmlToPdfConverter.HtmlLoadedTimeout = int.Parse(textBoxLoadHtmlTimeout.Text);
 
    // set PDF page size and orientation
    htmlToPdfConverter.Document.PageSize = GetSelectedPageSize();
    htmlToPdfConverter.Document.PageOrientation = GetSelectedPageOrientation();
 
    // set PDF page margins
    htmlToPdfConverter.Document.Margins = new PdfMargins(0);
 
    // set a wait time before starting the conversion
    htmlToPdfConverter.WaitBeforeConvert = int.Parse(textBoxWaitTime.Text);
 
    // convert HTML to PDF
    byte[] pdfBuffer = null;
 
    if (radioButtonConvertUrl.Checked)
    {
        // convert URL to a PDF memory buffer
        string url = textBoxUrl.Text;
 
        pdfBuffer = htmlToPdfConverter.ConvertUrlToMemory(url);
    }
    else
    {
        // convert HTML code
        string htmlCode = textBoxHtmlCode.Text;
        string baseUrl = textBoxBaseUrl.Text;
 
        // convert HTML code to a PDF memory buffer
        pdfBuffer = htmlToPdfConverter.ConvertHtmlToMemory(htmlCode, baseUrl);
    }
 
    // inform the browser about the binary data format
    HttpContext.Current.Response.AddHeader("Content-Type", "application/pdf");
 
    // let the browser know how to open the PDF document, attachment or inline, and the file name
    HttpContext.Current.Response.AddHeader("Content-Disposition", String.Format("{0}; filename=HtmlToPdf.pdf; size={1}",
        checkBoxOpenInline.Checked ? "inline" : "attachment", pdfBuffer.Length.ToString()));
 
    // write the PDF buffer to HTTP response
    HttpContext.Current.Response.BinaryWrite(pdfBuffer);
 
    // call End() method of HTTP response to stop ASP.NET page processing
    HttpContext.Current.Response.End();
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.