Problem in writing html tags to pdf file


#1

hi,

i have a problem with the pdf while writing html tags to the pdf. The problem i am getting

is it is writing the content to the pdf file but it is writing html tags also as string.

and the code and the pdf that i got i am sending you please give me the solution ASAP.

Code:

FileStream fs = new FileStream("c:/testing.pdf",FileMode.Create);

//Instantiate the Pdf instance and pass the file stream object to its constructor

Pdf pdf = new Pdf(fs);

//Add a section to the PDF document

Section sec1 = pdf.Sections.Add();

//Add 1000 text paragraphs to the section

Text t = new Text(info.ToString());

t.IsHtmlTagSupported=true;

sec1.AddParagraph(t);

//Close the Pdf. This method is used only for direct file mode

pdf.Close();

fs.Close();


#2

Your codes look great. So could u provide the Inline HTML for us tests?


#3

I just did a test for tag
and got a correct result. My codes are

-----------------------------

//Instantiate a pdf document
Pdf pdf1 = new Pdf();


//Create a section in the pdf document
Aspose.Pdf.Section sec1 = pdf1.Sections.Add();


//Create string variables with text containing html tags
string s = "This is a test for
HTML</ support
in Text paragraph. ";
//Create text paragraphs containing HTML text
Text t1 = new Text(s);
t1.IsHtmlTagSupported = true;
//Add the text paragraphs containing HTML text to the section
sec1.Paragraphs.Add(t1);
pdf1.Save(@"E:\NeedToTest\PDF\TestHtml.pdf");

----------------------------

So I guess the problem you have may be caused by some mistakes written in your Inline HTML.