Trying to follow the example here, I added the following code to create the title of a PDF doc:
using (var doc = new Document(PageSize.A4, 50, 50, 25, 25))
{
using (var writer = PdfWriter.GetInstance(doc, ms))
{
doc.Open();
var docTitle = new Paragraph("UCSC Direct - Direct Payment Form");
var titleFont = FontFactory.GetFont("Lucida Sans", 18, Font.Bold);
doc.Add(docTitle);
However, the attempt to create titleFont wouldn't compile ("The best overloaded method match for 'iTextSharp.text.FontFactory.GetFont(string, float, iTextSharp.text.BaseColor)' has some invalid arguments"), so I let intellisenseless "help" me by adding one arg at a time. Since for the first arg it said it was the font name, a string, I added "Segoe UI"; the next arg was font size, a float, so I added 18.0; finally, it called for the font color, a BaseColor type, so I added BaseColor.Black, ending up with:
var titleFont = FontFactory.GetFont("Segoe UI", 18.0, BaseColor.BLACK);
...but that also won't compile, saying "The best overloaded method match for 'iTextSharp.text.FontFactory.GetFont(string, string, bool)' has some invalid arguments"
So when I copied the example, and used string, int, and Font style, it said no, it wants string, float, and BaseColor. When I then added those arguments, it changed its "mind" and said what it really wants is string, string, and bool?
Also, the example shows then adding the paragraph to the document like so:
doc.Add(docTitle, titleFont);
...but that won't fly, either, as "No overload for method 'Add' takes 2 arguments"
What can I do to mollify iTextSharp? Whether I dance a jig or chant a dirge, it doesn't want to play along.
UPDATE
Okay, this compiles:
var docTitle = new Paragraph("UCSC Direct - Direct Payment Form");
var titleFont = FontFactory.GetFont("Courier", 18, BaseColor.BLACK);
docTitle.Font = titleFont;
doc.Add(docTitle);