I need to write a paragraph to a PDF file I'm generating. Said paragraph is comprised of a bolded first word in red, some "regular" red text after that, then a link (blue), some more regular red text, and finally another link (also blue). I think I can use Chunks to do that, something like this (pseudocode):
Chunk boldChunk = new Chunk("Important:"); // add font via GetFont?
boldChunk.SetBold();
boldChunk.SetColor(red);
Chunk beginChunk = new Chunk("Form must be filled out in ");
beginChunk.SetColor(red);
Chunk underlinedAdobeReader = new Chunk("Adobe Reader");
underlinedAdobeReader.SetUnderline(0.5f, -1.5f);
underlinedAdobeReader.SetColor(blue);
underlinedAdobeReader.SetHRef("http://www.adobe.com");
Chunk middleChunk = new Chunk("or Acrobat Professional
8.1 or above. To save completed forms, Acrobat Professional is required. For
technical and accessibility assistance, contact the ");
middleChunk.SetColor(red);
Chunk underlinedJefe = new Chunk("Chief Platypus");
underlinedJefe.SetUnderline(0.5f, -1.5f);
underlinedJefe.SetColor(blue);
underlinedJefe.SetHref("http://twaincentral.azurewebsites.net/");
doc.Add(boldChunk);
doc.Add(beginChunk);
doc.Add(underlinedJefe);
doc.Add(middleChunk);
doc.Add(underlinedCampusOffice);
....but that seems borderline outlandish; Is there a way I can "cut to the chase" and assign some HTML to the doc, as in:
String composite = "<strong>Important:</strong> Form must be filled out in <a href="http://www.adobe.com" target="_blank">Adobe Reader</a>
or Acrobat Professional
8.1 or above. To save completed forms, Acrobat Professional is required. For
technical and accessibility assistance, contact the <a href="http://twaincentral.azurewebsites.net/" target="_blank">Chief Platypus</a>");
doc.Add(composite);
I also want to restrict this paragraph to West of the Mississippi (that is to say, the left half of the page), but that is a separate issue.