I'm trying to write a pdf document with itextsharp but I wont to alternate between two styles: the title and the paragraph.
I tryed something like this:
Paragraph title= new Paragraph();
title.Alignment = Element.ALIGN_CENTER;
title.Font = FontFactory.GetFont("Arial", 32);
title.Add("\nTitle 1\n\n");
pdfDoc.Add(title);
Paragraph paragraph = new Paragraph();
paragraph.Alignment = Element.ALIGN_LEFT;
paragraph.Font = FontFactory.GetFont("Arial", 12);
paragraph.Add("Lorem ipsum dolor sit amet \n");
pdfDoc.Add(paragraph);
title.Add("\nTitle 2\n\n");
pdfDoc.Add(title);
paragraph.Add("Consectetur adipiscing elit \n");
pdfDoc.Add(paragraph);
But it looks like I need to clear the content before adding the new text. Is it possible to clear just the text or would I have to create new variables for each paracgraph? Hope not....