locked
need to convert html text into pdf without losing formatting like color style tags RRS feed

  • Question

  • User2104229528 posted

    Hello,

    I need to save the formatting of the text below

    html text

    <font size="2"><span style="font-family: Arial;">hello<br><br>
    <br style="font-weight: bold; text-decoration: underline;"></span></font>
    <div style="text-align: center;"><font size="2"><span style="font-family: Arial;">
    <span style="font-weight: bold; text-decoration: underline;">I need to save the formatting</span>
    <span style="font-weight: bold;"> <span style="color: rgb(255, 0, 0);">of this text.</span>
    </span></span></font>
    <br><div style="text-align: left;"><br></div><br><div style="text-align: left;"><br></div><font size="2">
    <span style="font-family: Arial;"></span></font></div>

    I need to convert html text to pdf without lsing formatting as style tags .It needs to be a c# based solution.

    Thursday, December 29, 2011 1:49 PM

Answers

All replies

  • User-2010311731 posted

    I use the RadEditor to do this type of functionality...

    http://demos.telerik.com/aspnet-ajax/editor/examples/pdfexport/defaultcs.aspx

    There are several other WYSIWYG editors out there like Cute Editor, CKEditor, etc.  I am not sure which ones are free.

    Also, you might look into iTextSharp...

    http://sourceforge.net/projects/itextsharp/

     

    Matt

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, December 29, 2011 5:47 PM
  • User2104229528 posted

    is there a solution without third party controls..

    I am able to generate pdf thru itextsharp but the reqmt is to have css in pddf without losing style tags and fonts.....

    is there a csharp solution avalible or any idea thru code?

    Friday, December 30, 2011 2:21 AM
  • User-2010311731 posted

    Not without re-inventing what others have already done.  I still suggest a WISYWIG editor because they make it so much easier.  If this is not an option, you will need to go through the documentation from Adobe (or others) in order to find out all of their API calls to create a PDF file from your own code.  Honestly, I have never done this because it wopuld take weeks of work to figure out.  If somebody else has a suggestion, I would love to hear it as well!!

     

    Matt

    Friday, December 30, 2011 9:17 AM
  • User3866881 posted

    Hello Giro:)

    For converting from a pure html to pdf,you can use this tool:http://www.winnovative-software.com/Html-To-Pdf-Converter.aspx

    PS:This is a 3-rd party library,So microsoft doesn't take the responsibility for that usage。Only a recommand……

    Best reguards!

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, December 30, 2011 8:20 PM