Reputation: 586
I am very new to C# and I am creating a small program to create PDF invoices. All I need to do is set the font size of my text within a table cell, however the recommended methods are not working at all. I am working in Visual Studio 2019 and using iTextSharp version 5.5.13.1. Here is my attempt:
PdfPCell cell3 = new PdfPCell(new Phrase(float.Parse("Quantity"), new Font(Font.HELVETICA, 8f, Font.NORMAL, Color.YELLOW)));
But I got an error:
'Font' is an ambiguous reference between System.Drawing.Font and iTextSharp.text.Font`.
However I figured this one out in that I have to destinguish between which font source I am using (Not sure if I am saying this correctly.). So I tried the following:
PdfPCell cell3 = new PdfPCell(new Phrase(float.Parse("Quantity"), new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 8f, iTextSharp.text.Font.NORMAL)));
But now I am getting an error:
Argument 2: Cannot convert from iTextSharp.text.Font to iTextSharp.text.Chunk.
All I want is to set the font size...
Upvotes: 0
Views: 832
Reputation: 1
You can use the below method.
using iTextSharp.text;
using iTextSharp.text.pdf;
PdfPCell cell3 = new PdfPCell(new Phrase("Phrase", new Font(iTextSharp.text.Font.FontFamily.COURIER, 16, iTextSharp.text.Font.NORMAL)));
Upvotes: 2