Div to pdf

2 posts, 0 answers
  1. Troy Clemons
    Troy Clemons avatar
    69 posts
    Member since:
    Apr 2010

    Posted 11 May 2015 Link to this post

    is there a way to convert a div and all its inner html to a pdf.
  2. Petya
    Petya avatar
    983 posts

    Posted 13 May 2015 Link to this post

    Hi Troy,

    There are a couple of options that you can try in order to achieve this result.

    One is the Telerik ASP.NET ClientExportManager that was recently introduced. Take a look at this demo and see how it fits your needs.

    The alternative is to use the WordsProcessing library to convert the document. You can use the HtmlFormatProvider class to import HTML content and then export it with PdfFormatProvider. I suggest you take a look at this demo and try the library out in your scenario. 

    You should be aware that the latter approach would convert the HTML you pass to the document model of the library with base class RadFlowDocument. This means that if there is an element on the HTML page that cannot be converted, it will be skipped, so there may be some differences between the original page and the exported PDF. Additionally, you might want to take a look at the settings of the HtmlFormatProvider to learn about the available customization options.

    I hope this is useful.

Back to Top