convert div content to pdf RRS feed

  • Question

  • how to convert the page content to pdf and download with all styles and content same as in page in C# with out using any dll?

    Wednesday, February 1, 2017 4:35 AM

All replies

  • I dont think there is any way without DLL's . I used third party muhimbi pdf converter and achieved the same.
    Wednesday, February 1, 2017 6:04 AM
  • is their a way to do the same using jquery or javascript.

    I used jsPDF plugin, but the styles did not apply, only the text content were displayed.


    Wednesday, February 1, 2017 7:25 AM
  • Hi,

    Please check the code below:


    <div id="content">
         <h3>Hello, this is a H3 tag</h3>
        <p>a pararaph</p>
    <div id="editor"></div>
    <button id="cmd">generate PDF</button>


    var doc = new jsPDF();
    var specialElementHandlers = {
        '#editor': function (element, renderer) {
            return true;
    $('#cmd').click(function () {
        doc.fromHTML($('#content').html(), 15, 15, {
            'width': 170,
                'elementHandlers': specialElementHandlers

    More information:

    Best Regards,


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact

    Tuesday, February 7, 2017 7:06 AM
  • another way is to use browser's print functionality, but in this case users will need to choose PDF printer in printers list by themselves (also they may not have it). So jsPDF looks as optimal solution here.

    Blog -
    Dynamic CAML queries via C# -

    Tuesday, February 7, 2017 2:38 PM
  • Hi,

    like said Dennis you can use jsPDF (javascript library) for your purpose, I used it personally for a project and works really well.

    I suggest you my blog post like a demo and taking confidence:

    Kind regards,

    Giuliano De Luca - MCSD SharePoint, MCSD Web Applications, MCPS, MS. Twitter: @giuleon Please Mark As Answer if my post solves your problem or Vote As Helpful if the post has been helpful for you.

    Tuesday, February 7, 2017 3:17 PM