Non Invocable member iTextSharp.text.font cannot be used like a method

        iTextSharp.text.Font fontbold = iTextSharp.text.FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 10);
        iTextSharp.text.Font font5 = iTextSharp.text.FontFactory.GetFont(FontFactory.HELVETICA, 8);

        //data display
        string name =Environment.MachineName;
        string date = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt");
        string empty = "";
        string heading = "SUMMARY REPORT";
        string beginning = "\nAccount Id : " + accountId + "\nTestScenarioId  : " + testScenarioId + "\nMachine Name  : " + name + "\nScheduledDate  : " + date + "\nServerURL :" + serverURL + "\n " + empty;
        Phrase ph = new Phrase(beginning);
        Phrase phr = new Phrase(heading);
        Paragraph p = new Paragraph();
        Paragraph pr = new Paragraph();
        p.Font(font5);---------------------------------------------------//Error
        pr.Font(fontbold);----------------------------------------------//Error
        p.Add(ph);
        pr.Add(phr);

        document.Add(phr);
        document.Add(p);

I want to display that heading in bold letters.Its showing an error as Non Invocable member iTextSharp.text.font cannot be used like a method.What should i do now?I am doing this in c# for writing in pdf using iTextsharp

Jon Skeet
people
quotationmark

Well I suspect that Font is a property rather than a method, in which case you'd just want:

p.Font = font5;
pr.Font = fontbold;

That would certainly be more idiomatic C#. I haven't used iTextSharp, so I could be wrong, but that would be the first thing I'd try.

(Indeed, consulting some documentation that appears to be the case.)

people

See more on this question at Stackoverflow